PaPP v2: banda = min/max MA (range completo 8 timeframes)
This commit is contained in:
@@ -169,14 +169,14 @@ void OnTick()
|
|||||||
//--- Update TP/SL per tutte le posizioni con la mediana corrente
|
//--- Update TP/SL per tutte le posizioni con la mediana corrente
|
||||||
UpdateTPSL(median);
|
UpdateTPSL(median);
|
||||||
|
|
||||||
//--- Dispersione MA = banda strutturale del cluster
|
//--- Banda = min/max dell'intero range di MA (nessun parametro)
|
||||||
int dc=0; double ds=0;
|
double minMA=mv[0], maxMA=mv[0];
|
||||||
for(int m=0;m<8;m++)
|
for(int m=1;m<8;m++)
|
||||||
if(mv[m]>0) { ds+=MathAbs(mv[m]-median)/median*100; dc++; }
|
if(mv[m]>0) {
|
||||||
double vol = (dc>0) ? ds/dc : 0;
|
if(mv[m]<minMA) minMA=mv[m];
|
||||||
|
if(mv[m]>maxMA) maxMA=mv[m]; }
|
||||||
|
|
||||||
double sellBand = median*(1+vol/100);
|
double buyBand=minMA, sellBand=maxMA;
|
||||||
double buyBand = median*(1-vol/100);
|
|
||||||
double distPct = (bid-median)/median*100;
|
double distPct = (bid-median)/median*100;
|
||||||
|
|
||||||
int nBuy = CountPos(POSITION_TYPE_BUY);
|
int nBuy = CountPos(POSITION_TYPE_BUY);
|
||||||
@@ -200,7 +200,7 @@ void OnTick()
|
|||||||
Print("");
|
Print("");
|
||||||
Print("=== BAR: ",TimeToString(curBar)," ===");
|
Print("=== BAR: ",TimeToString(curBar)," ===");
|
||||||
Print("Bid=",DoubleToString(bid,_Digits)," Median=",DoubleToString(median,_Digits));
|
Print("Bid=",DoubleToString(bid,_Digits)," Median=",DoubleToString(median,_Digits));
|
||||||
Print("Dist=",DoubleToString(distPct,3),"% DispMA=",DoubleToString(vol,4),"%");
|
Print("Dist=",DoubleToString(distPct,3),"% Range=",DoubleToString((maxMA-minMA)/median*100,3),"%");
|
||||||
Print("Trend: ",trendUp?"UP":trendDown?"DOWN":"MIX", " Allow: ",allowBuy?"B":"-",allowSell?"S":"-");
|
Print("Trend: ",trendUp?"UP":trendDown?"DOWN":"MIX", " Allow: ",allowBuy?"B":"-",allowSell?"S":"-");
|
||||||
Print("Band: [",DoubleToString(buyBand,_Digits)," <- ",DoubleToString(sellBand,_Digits)," ] Pos: ",nBuy,"B ",nSell,"S");
|
Print("Band: [",DoubleToString(buyBand,_Digits)," <- ",DoubleToString(sellBand,_Digits)," ] Pos: ",nBuy,"B ",nSell,"S");
|
||||||
for(int m=0;m<8;m++)
|
for(int m=0;m<8;m++)
|
||||||
|
|||||||
Reference in New Issue
Block a user