Stop loss not triggered on automatic trading system
Forums › ProRealTime English forum › ProRealTime platform support › Stop loss not triggered on automatic trading system
- This topic has 34 replies, 8 voices, and was last updated 4 years ago by Granatins.
-
-
08/10/2018 at 6:20 AM #77920
Fwd / Forward test is running a Strategy / System in realtime / live trading … usually on your Demo Platform with virtual money (also referred to as paper trading)?
Yes, that’s what I’ve been doing. 🙂 I have my systems run live on my demo account with virtual money. My problem is that I can’t trust the systems. Some days I have crazy stop/limit levels that come from nowhere, some days a system is running but not triggering any orders although it should. And somedays my systems opens orders ignoring all stop/limit levels altogether.
We’ll see if it happens today as well.
08/10/2018 at 8:26 AM #77929If you want folk on here to offer reasons then you need to post your code and a few screen shots of what you consider the System is not doing correct etc?
Also screen shots of comparison between Fwd Test and Back Test with you highlighting on the screenshot where trades are not the same etc?
Make it easy for folk to help you?
1 user thanked author for this post.
08/10/2018 at 12:47 PM #77961Without looking at your code, there are not other help we can afford, sorry.
1 user thanked author for this post.
08/14/2018 at 8:16 AM #78123Hey, here’s the code for a system I’m running on the DAX 4H timeframe. I was thinking, can it have anything to do with the space between the lines of text? Because this is exactly how the code is written in PRT. It does look a bit messy maybe.
1234567891011121314151617181920212223242526Defparam FlatBefore = 125500Defparam FlatAfter = 170000xClose = (Open+High+Low+Close)/4if(barindex>2) thenxOpen = (xOpen[1] + xClose[1])/2endifc1 = xClose>xOpen AND xClose[1]<xOpen[1]c2 = xClose<xOpen AND xClose[1]>xOpen[1]if c2 AND Not LongOnMarket thenBUY 1 SHARE AT MARKETEXITSHORT AT MARKETendifif c1 AND Not ShortOnMarket thenSELLSHORT 1 SHARE AT MARKETSELL AT MARKETendifSET STOP $TRAILING 20set target pprofit 4008/14/2018 at 8:20 AM #78124Hey, here’s the code for a system I’m running on the DAX 4H timeframe. I was thinking, can it have anything to do with the space between the lines of text? Because this is exactly how the code is written in PRT. It does look a bit messy maybe.
Hmm, when posting my reply the code was cleaned up from the line breaks. But I guess that shouldn’t matter too much anyway.
08/14/2018 at 8:24 AM #78125I edited it so that NOW it is exactly how it shold look in PRT.
As for blank lines you can add/remove them as you like.
1 user thanked author for this post.
08/14/2018 at 8:37 AM #78126Line 7 should read
1if(barindex>1) thenand line 5 should be included within IF … ENDIF, just before line 8.
1 user thanked author for this post.
08/14/2018 at 1:07 PM #78145Line 7 should read
1if(barindex>1) thenand line 5 should be included within IF … ENDIF, just before line 8.
Thanks a lot. I also noticed this trailing stop is automatically set to trail in 5 pip steps, although I don’t seem to have defined that anywhere in the code. Maybe that has to do with the broker?
08/14/2018 at 2:08 PM #78150At line 24 you set a TRAILING STOP.
1 user thanked author for this post.
08/15/2018 at 8:10 AM #78222At line 24 you set a TRAILING STOP.
Yeah I know. What I meant was that even though my trailing stop is 20, the steps are 5 pips, not 20 pips.
Anyway, right now I should have an open position running on my 4H system but no order has been triggered. No canceled or rejected orders either.
The code is the same as above, the only difference is the timeframe:Defparam FlatBefore = 085500Defparam FlatAfter = 130000My system should have opened a long position at 09:00. If I do a backtest tomorrow it will probably show a trade taken on Aug 15, 09:00. We’ll see.
08/15/2018 at 8:36 AM #78224I’m running on the DAX 4H timeframe.
If so then:
12Defparam FlatBefore = 085500Defparam FlatAfter = 130000….will never be met as there is no 085500 or 130000 candles on a 4 hour chart.
1 user thanked author for this post.
08/15/2018 at 9:27 AM #78232Your line 24 orders the system to trail each 20 units of your currency (€ if your account is in Euros, or whatever it is). If you want to trail each 20 pips you should use
1SET STOP pTRAILING 20As for your dsired time, do you want to enter a trade only if the 4-hour bar starting at 090000 meets your conditions?
1 user thanked author for this post.
08/15/2018 at 9:31 AM #78233I’m running on the DAX 4H timeframe.
If so then:
12Defparam FlatBefore = 085500Defparam FlatAfter = 130000….will never be met as there is no 085500 or 130000 candles on a 4 hour chart.
There is a candle starting at 130000, it’s the one after 090000.
I am not sure whether DEFPARAM FlatBefore/After match the timing of candlesticks. I think they are system dependent, so that, no matter what TF you use, ProOrder won’t accept orders before that time and will cancel any open trade after that time. But I am not sure about that!
08/15/2018 at 9:40 AM #78235There is a candle starting at 130000, it’s the one after 090000. I am not sure whether DEFPARAM FlatBefore/After match the timing of candlesticks. I think they are system dependent, so that, no matter what TF you use, ProOrder won’t accept orders before that time and will cancel any open trade after that time. But I am not sure about that!
You are obviously working in a different time zone to me then – but there is still no 085500 candle which means that condition will never be met. PRT can only see candles that actually exist on the chart so you will have 010000, 050000, 090000, 130000, 170000 and 210000 candles and nothing else. These are the only times you can use in any strategy used on a 4 hour chart.
I might be wrong on this as I never use FLATBEFORE and FLATAFTER – maybe Nicolas can confirm for us how fussy these defined parameters are about the time used.
08/15/2018 at 9:44 AM #78237I’m running on the DAX 4H timeframe.
If so then:
12Defparam FlatBefore = 085500Defparam FlatAfter = 130000….will never be met as there is no 085500 or 130000 candles on a 4 hour chart.
Makes sense. But, it’s been running fine for most of the time. But it’s not consistent. Have a look at my previous trades on this system.
-
AuthorPosts
Find exclusive trading pro-tools on