Check of previous candles
Forums › ProRealTime English forum › ProOrder support › Check of previous candles
- This topic has 31 replies, 3 voices, and was last updated 5 years ago by Marc.
-
-
07/13/2018 at 1:25 PM #75916
Hi together,
I need some help regarding checking of previous candles in different periods.
I’m working with a trend following systems which cheks if the previuos months open is higher or lower. Than it checks if the last months candle is higher or lower.
If previous moth and previous week candles are in the same direction than the systems checks the previous days candle (except monday). If previous days candle is in the opposite direction of previos month and week than an order will be set either on the high or the low of previous days candle.
Example:
Month: bullish = open < close
Week: bullish = open < close
Day: bearish = open > close
Set a buy order at high of bearish candleMonth: bearish= open > close
Week: bearish = open > close
Day: bullish = open < close
Set a sell order at low of bearish candleEach friday evening non executed orders will be deleted.
Monday is not a trading day
SL an TP are ATR(2)
If sell /buy stop order is not filled within the next day and on the curent day the previous days candle is still in the opposite direction of compared monthly and weekly candle than buy stop and sell stop must be amended to previous days high / low.I hope that anyone can help me with this system. In my opninion this should generate good trades with mostly positive results.
Thank you in advance
Marc07/19/2018 at 9:31 AM #7629007/19/2018 at 9:38 AM #76294Please do not duplicate posts in different topics and languages, this won’t help and will shatter replies among different topics making it more difficult to retrieve. Thank you.
Which one do you prefer to keep, the english or german one?
07/19/2018 at 10:07 AM #76295…
I’m working with a trend following systems which checks if the previous month’s open is higher or lower. Then it checks if the last month’s candle is higher or lower.
…What do you mean with the BLUE sentence, shall OPEN be higher than…. what?
What do you mean with the RED sentence, shall the …what?… of the CANDLE be higher/lower than… what again?
07/23/2018 at 11:27 PM #76559Ciao Roberto,
I’d like to keep / collect all information in the english version.
1st of all thank you for your reply.I made a mistake while describing the system in the first sentence. It should be read as follows:
The System shall recognize if the previous months direction is bullish (close > open) or bearish (close < open). Afterwards the system shall recognize if the previous week is bullish (close > open) or bearish (close < open). If both previous monthly and weekly candle moves in the same direction (either both directions are bearish or bullish) then the system checks on tuesday if the monday candles direction is opposite (close < open) compared with monthly and weekly candle.This means if previous month and week are bullish than the rules set a pending order on high of mondays candle incl. slippage and spread (order must be set on tuesday because mondays candle hasn’t finished until this candle close due to change of date). If on Tuesday the order is not triggered, but the tuesdays candle also moves in the opposite direction of previous month and week candle the current pending order has to be amended to high of tuesdays candle and so on. If order was’t triggered within this week all pending orders will be deleted on Friday Evening.
For bearish set up above rules must be used vice versa.
Currently there is no TP and SL mentioned in the system which would be necessary if basic of this system works.I hope I clarified the rules of this system.
Thank you in advance
Marc
07/24/2018 at 4:52 PM #76636Try this code, I just run it to check syntax and if it opened any trades:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162DEFPARAM CumulateOrders = falseTIMEFRAME (Monthly, updateonclose)IF close > open THENMyMonth = 1 //BULLishELSEMyMonth = -1 //BEARishENDIFTIMEFRAME (Weekly, updateonclose)IF close > open THENMyWeek = 1 //BULLishELSEMyWeek = -1 //BEARishENDIFTIMEFRAME (Daily, updateonclose)ONCE AlreadyTraded = 0IF close > open THENMyDay = 1 //BULLishELSEMyDay = -1 //BEARishENDIFThisDay = OpenDayIF ThisDay = 1 AND Not OnMarket AND AlReadyTraded = 0 THEN //MondayGoLong = MyMonth = 1 AND MyWeek = 1 AND MyDay = -1GoShort = MyMonth = -1 AND MyWeek = -1 AND MyDay = 1IF GoLong THENEntryPrice = highBUY 1 CONTRACT AT EntryPrice LIMITELSIF GoShort THENEntryPrice = lowSELLSHORT 1 CONTRACT AT EntryPrice LIMITENDIFSl = AverageTrueRange[2](close)Tp = SlSET Stop Loss SlSET Target Profit TpENDIFIF ThisDay = 2 AND Not OnMarket AND AlReadyTraded = 0 THEN //TuesdayGoLong = MyMonth = 1 AND MyWeek = 1 AND MyDay[1] = -1 AND MyDay = -1GoShort = MyMonth = -1 AND MyWeek = -1 AND MyDay[1] = 1 AND MyDay = 1IF GoLong THENEntryPrice = highBUY 1 CONTRACT AT EntryPrice LIMITELSIF GoShort THENEntryPrice = lowSELLSHORT 1 CONTRACT AT EntryPrice LIMITENDIFSl = AverageTrueRange[2](close)Tp = SlSET Stop Loss SlSET Target Profit TpENDIFIF ThisDay = 1 AND Not OnMarket THENAlreadyTraded = 0ENDIFIF OnMarket THENAlreadyTraded = 1ENDIF07/24/2018 at 10:29 PM #7665007/24/2018 at 10:42 PM #7665107/24/2018 at 10:51 PM #7665307/24/2018 at 11:04 PM #76654My system works perfectly, the attached screenshot is for DAX daily, but it works on any instrument.
There must be an error in the first 2 lines.
Did you import the file?
07/25/2018 at 7:41 AM #7666207/25/2018 at 8:43 AM #7666907/25/2018 at 8:44 AM #7667107/25/2018 at 8:51 AM #76672Yes, it only works on demo accounts. You’ll have to wait a few months to be able to run it, then!
I’ll work on trying to make it work on Real accounts, removing TIMEFRAME and using FOR…NEXT loops to scan past weeks and months, but I fear it’ll be a time-consuming code, if I can code it!
I’ll let you know.
07/25/2018 at 8:53 AM #76673 -
AuthorPosts
Find exclusive trading pro-tools on