Forums › ProRealTime English forum › ProOrder support › Help with a condition › Reply To: Help with a condition
09/03/2018 at 7:25 PM
#79676
Hi raphaelopilski, could you make strategy work? I didn’t have problems, but some people did. If you have any comment about strategy to enhance it, it would be great 😉
You can try this (is a piece of code I found in a strategy):
First of all you should change
1 |
DEFPARAM CumulateOrders = False |
to
1 |
DEFPARAM CumulateOrders = True |
Later, insert this before “Conditions”
1 2 3 4 5 6 7 8 9 10 11 12 13 |
//dynamic step grid minSTEP = 5 //minimal step of the grid maxSTEP = 20 //maximal step of the grid ATRcurrentPeriod = 5 //recent volatility 'instant' period ATRhistoPeriod = 100 //historical volatility period ATR = averagetruerange[ATRcurrentPeriod] histoATR= highest[ATRhistoPeriod](ATR) resultMAX = MAX(minSTEP*pipsize,histoATR - ATR) resultMIN = MIN(resultMAX,maxSTEP*pipsize) gridstep = (resultMIN) |
Also, after fist trade, insert this…
1 2 3 4 5 6 7 8 9 |
// case BUY - add orders on the same trend if longonmarket and close-tradeprice(1)>=gridstep*pipsize then BUY amount LOT AT MARKET endif // case SELL - add orders on the same trend if shortonmarket and tradeprice(1)-close>=gridstep*pipsize then SELLSHORT amount LOT AT MARKET endif |
I didn’t try but it shoul work. You have to tune vars at first for specific market. Basically it’s a grid steps system and it adds orders based in those steps.
I hope this helps.