07/16/2017 at 6:38 PM #40805
it seems to be very profitable to trade the breakout of the Asia session in gbpusd when all candles stay under the ema 63 for short or when all candles stay above the ema ( dont touch it ) for long. Sl at the other side of the range or 30 pips. This should show the backtest. 1hour chart!
I am not able to program a fixed range from 0-7 h (so the first 8 candles of the day in 1h chart) and set the orders right.
Can someone help me?
Thank you!07/16/2017 at 7:32 PM #40818
You may try this. I did not test it, so you are likely to have to make corrections, besides inserting your code to handle your strategy:123456789101112131415161718192021222324252627282930DEFPARAM CumulateOrders = False //no more than 1 trade allowedDEFPARAM FlatAfter = 235959 //Comment this out to keep trades running overnightONCE StartBreak = 000000 //Start of BreakOut strategy time, no tradesONCE EndBreak = 070000 //End of BreakOut strategy time, trades onONCE NoMoreTrades = 240000 //Time to stop entering new tradesONCE MinPrice = 0 //Lowest price (initial value)ONCE MaxPrice = 0 //Highest price (initial value)IF (time >= StartBreak) AND (time <= EndBreak) THEN //Check at each barIF close < MinPrice THEN //Update minimun if a lower closing price is metMinPrice = closeENDIFIF close > MaxPrice THEN //Update maximum if a higher closinfg price is metMaxPrice = closeENDIFENDIFIF OnMarket THEN //Set variables to initial ZERO after entering aMinPrice = 0 // trade, so they are ready for the next break outMaxPrice = 0ENDIFIF (time >= EndBreak) AND (time < NoMoreTrades) THEN.. //you wanna put your orders here according to. // your conditions.ENDIF
Hope this is what you were looking for.