Stop loss not triggered on automatic trading system

Viewing 15 posts - 16 through 30 (of 35 total)
  • Author
    Posts
  • #77920 quote
    Shitforbrains
    Participant
    Average
    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. 




     

    #77929 quote
    GraHal
    Participant
    Master

    If 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?   

    Shitforbrains thanked this post
    #77961 quote
    Nicolas
    Keymaster
    Master

    Without looking at your code, there are not other help we can afford, sorry.

    Shitforbrains thanked this post
    #78123 quote
    Shitforbrains
    Participant
    Average
    Hey, 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.
    Defparam FlatBefore = 125500
    
    Defparam FlatAfter = 170000
    
    xClose = (Open+High+Low+Close)/4
    
    if(barindex>2) then
    xOpen = (xOpen[1] + xClose[1])/2
    endif
    
    c1 = xClose>xOpen AND xClose[1]<xOpen[1]
    c2 = xClose<xOpen AND xClose[1]>xOpen[1]
    
    if c2 AND Not LongOnMarket then
    BUY 1 SHARE AT MARKET
    EXITSHORT AT MARKET
    endif
    
    if c1 AND Not ShortOnMarket then
    SELLSHORT 1 SHARE AT MARKET
    SELL AT MARKET
    endif
    
    SET STOP $TRAILING 20
    
    set target pprofit 40
    #78124 quote
    Shitforbrains
    Participant
    Average
    Hey, 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.
    #78125 quote
    robertogozzi
    Moderator
    Master
    I 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.
    Shitforbrains thanked this post
    #78126 quote
    robertogozzi
    Moderator
    Master
    Line 7 should read
    if(barindex>1) then
    and line 5 should be included within IF … ENDIF, just before line 8.
    Shitforbrains thanked this post
    #78145 quote
    Shitforbrains
    Participant
    Average
    Line 7 should read and 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?
    #78150 quote
    robertogozzi
    Moderator
    Master
    At line 24 you set a TRAILING STOP.
    Shitforbrains thanked this post
    #78222 quote
    Shitforbrains
    Participant
    Average
    At 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 = 085500
    Defparam FlatAfter = 130000 My 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.
    #78224 quote
    Vonasi
    Moderator
    Master
    I’m running on the DAX 4H timeframe.
    If so then:
    Defparam FlatBefore = 085500
    Defparam FlatAfter = 130000
    ….will never be met as there is no 085500 or 130000 candles on a 4 hour chart.
    Shitforbrains thanked this post
    #78232 quote
    robertogozzi
    Moderator
    Master
    Your 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
    SET STOP pTRAILING 20
    As for your dsired time, do you want to enter a trade only if the 4-hour bar starting at 090000 meets your conditions?
    Shitforbrains thanked this post
    #78233 quote
    robertogozzi
    Moderator
    Master
    I’m running on the DAX 4H timeframe.
    If so then: ….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!
    #78235 quote
    Vonasi
    Moderator
    Master
    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!
    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.
    #78237 quote
    Shitforbrains
    Participant
    Average
    I’m running on the DAX 4H timeframe.
    If so then: ….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.
    4H-Timeframe-0900-1300.jpg 4H-Timeframe-0900-1300.jpg
Viewing 15 posts - 16 through 30 (of 35 total)
  • You must be logged in to reply to this topic.

Stop loss not triggered on automatic trading system


Platform Support: Charts, Data & Broker Setup

New Reply
Author
Summary

This topic contains 34 replies,
has 8 voices, and was last updated by Granatins
5 years, 1 month ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 07/26/2018
Status: Active
Attachments: 4 files
Logo Logo
Loading...