trailing stop keeps getting rejected

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #151599 quote
    jayvee
    Participant
    Average

    Greeting all, Hope you’re keeping well and safe. I’m a bit stuck. I have ‘set stop trailing’ in a code I’m testing out, but while the order to buy the stock goes through, the trailing stop doesn’t. When you hover over the rejected sign (under order list) it states the stop distance was too far from the opening market level. I’m not sure what I’m doing wrong??

    IF Bullish0 THEN
    buy (100/(2*atr)) perpoint AT MARKET
    set stop trailing (2*atr)
    
    ENDIF
    
    #151654 quote
    jayvee
    Participant
    Average

    sorry i put this in the wrong section

    #151658 quote
    robertogozzi
    Moderator
    Master

    Moved to correct place

    #151666 quote
    jayvee
    Participant
    Average

    Thanks Roberto, much appreciated. Any idea on whats happening here. If the code is correct, could it be the timeframe issue that is mentioned on the other post (https://www.prorealcode.com/topic/changing-3-hr-bar-close-time/). Maybe its causing issues? As mentioned the IG platform doesnt mirror the prorealtime platform anymore (used to be the same) in regards to stocks such as amazon, apple (US stocks i think) at time frames such as the 2hr/3hr/4hr. The code used to work fine, so think it may be correlated with this timeframe issue…

    #151670 quote
    robertogozzi
    Moderator
    Master

    I have no idea. I can only suggest to use a trailing stop code snippet to replace the built-in SET STOP TRAILING instruction which is a bit awkward.

    #151688 quote
    Nicolas
    Keymaster
    Master

    Try with:

    IF NOT LONGONMARKET AND Bullish0 THEN
     buy (100/(2*atr)) perpoint AT MARKET
     set stop trailing (2*atr)
    ENDIF

    otherwise the trailing distance would be recalculated (with ATR) on each period and might be too far from the first place, you can’t enlarge your trailing stop with a limited risk account (if you have this type of account?).

    #151695 quote
    jayvee
    Participant
    Average

    Thanks Nicolas, I will try that. Do you have any idea about the timeframe issue on the platform? It’s not in line with the IG platform – I think that is causing issues too

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

trailing stop keeps getting rejected


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jayvee @jayvee Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by jayvee
5 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/25/2020
Status: Active
Attachments: No files
Logo Logo
Loading...