Range Break Out, wrong entry time/point
Forums › ProRealTime English forum › ProOrder support › Range Break Out, wrong entry time/point
- This topic has 5 replies, 2 voices, and was last updated 8 years ago by Leon.
-
-
10/11/2016 at 12:32 PM #14686
Hey guys,
I was coding a Range Break Out which you scan find at attachments (insert PRT code funktion was not warking properly for me).
Im wondering why it takes actions to late, exaplme also at attachments.
Entry should have been around 10.550, but it entered later – around 10.534 points at 09:05 o clock. This happened some more times – I just took this one for example. Is it maybe the time limitation in the code?
Does anybody got suggestions why this is happening? Is it a codingproblem in my Range Break Out?
BR
Leon
10/11/2016 at 12:53 PM #1469310/11/2016 at 1:01 PM #14696Hello Nicolas,
oh i thought it is in the attachments. Seems like its not. The code is running on demo, the uploaded trade is done with a demo account “live” to test its reliablility till 10.3 is implemented for Ig and i con do it with a reliable backtest 😉
Here is the code:
1234567891011121314151617181920212223242526272829303132ONCE daycount = Days - 1trailingv = 20sharestotrade = 1IF CurrentHour=8 THENIF daycount < Days THENhigvalue = Highlowvalue = Lowtotrade = 1daycount = DaysENDIFIF High>higvalue THENhigvalue = HighENDIFIF Low<lowvalue THENlowvalue = LowENDIFELSIF NOT ONMARKET AND CurrentTime<=153000 AND totrade THENIF close>=higvalue THENBUY sharestotrade SHARE AT MARKETtotrade=0SET STOP pTRAILING trailingvELSIF close<=lowvalue THENSELLSHORT sharestotrade SHARE AT MARKETtotrade=0SET STOP pTRAILING trailingvENDIFELSIF CurrentTime>=175500 AND longonmarket THENSELL AT MARKETELSIF CurrentTime>=175500 AND shortonmarket THENEXITSHORT AT MARKETENDIF10/11/2016 at 1:12 PM #14699Please use the good button to insert code next time, you don’t have an idea of how much posts I edit everyday.. Feel like a robot sometimes! 🙂
At lines 19 and 23 you are testing if the current close is above or below your trigger prices, but sometimes it’s too late, because the code is read at the close of the candle and price had already often gone away from them.
To avoid this, you should place STOP pending orders at levels you want your trade to be triggered. You’ll find a lot of examples on forums and in the Library I guess.
10/12/2016 at 8:40 AM #1474911/01/2016 at 10:51 AM #15808Hello Nicolas,
as you told me i tried to find a work arround to get the right entrie but after a lot of code test i cant get rid of the problem that the code i entering to late.
Can you give me some advice which code is working or which post is dealing with this? I looked trough the forum but wasn’t able to identify something that seemd like a solution.
Thanks in advance!
BR
Leon
-
AuthorPosts
Find exclusive trading pro-tools on