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
|
||||
UpdateTPSL(median);
|
||||
|
||||
//--- Dispersione MA = banda strutturale del cluster
|
||||
int dc=0; double ds=0;
|
||||
for(int m=0;m<8;m++)
|
||||
if(mv[m]>0) { ds+=MathAbs(mv[m]-median)/median*100; dc++; }
|
||||
double vol = (dc>0) ? ds/dc : 0;
|
||||
//--- Banda = min/max dell'intero range di MA (nessun parametro)
|
||||
double minMA=mv[0], maxMA=mv[0];
|
||||
for(int m=1;m<8;m++)
|
||||
if(mv[m]>0) {
|
||||
if(mv[m]<minMA) minMA=mv[m];
|
||||
if(mv[m]>maxMA) maxMA=mv[m]; }
|
||||
|
||||
double sellBand = median*(1+vol/100);
|
||||
double buyBand = median*(1-vol/100);
|
||||
double buyBand=minMA, sellBand=maxMA;
|
||||
double distPct = (bid-median)/median*100;
|
||||
|
||||
int nBuy = CountPos(POSITION_TYPE_BUY);
|
||||
@@ -200,7 +200,7 @@ void OnTick()
|
||||
Print("");
|
||||
Print("=== BAR: ",TimeToString(curBar)," ===");
|
||||
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("Band: [",DoubleToString(buyBand,_Digits)," <- ",DoubleToString(sellBand,_Digits)," ] Pos: ",nBuy,"B ",nSell,"S");
|
||||
for(int m=0;m<8;m++)
|
||||
|
||||
Reference in New Issue
Block a user