Limited risk account question about trailing stop

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #48888 quote
    Frytconcord
    Participant
    New
    Hello Nicolas
    is it possible that this code FBS EUR/USD “ALE – KASPER reinvestement” works with a limited risk account? Because there is the function “TRAILING STOP” can you explain to me ? thank you in advance.
    //TRAILING STOP
    TGL =5
    TGS=5
    if not onmarket then
       MAXPRICE = 0
       MINPRICE = close
       PREZZOUSCITA = 0
    ENDIF
    if longonmarket then
       MAXPRICE = MAX(MAXPRICE,close)
       if MAXPRICE-tradeprice(1)>=TGL*pointsize then
          PREZZOUSCITA = MAXPRICE-TGL*pointsize
       ENDIF
    ENDIF
    if shortonmarket then
       MINPRICE = MIN(MINPRICE,close)
       if tradeprice(1)-MINPRICE>=TGS*pointsize then
          PREZZOUSCITA = MINPRICE+TGS*pointsize
       ENDIF
    ENDIF
    if onmarket and PREZZOUSCITA>0 then
       EXITSHORT AT PREZZOUSCITA STOP
       SELL AT PREZZOUSCITA STOP
    ENDIF
    

     

    #48900 quote
    JC_Bywan
    Moderator
    Master

    Bonjour Frytconcord et bienvenue sur les forums de PRC, ayant des forums divisés par langues, puis par sous-thèmes, la coutume dans les forums PRC est de parler la langue du forum où on poste, merci de rester en Français sur le présent forum, et de réserver l’Anglais pour les forums PRC anglais.

    Aussi, j’édite ton message pour mettre le listing du code au bon format, mais merci pour les prochains messages d’utiliser le bouton <> dans la barre d’outil de l’éditeur de messages pour insérer du code au format PRT.


    Hello Frytconcord and welcome to the forums of PRC, having forums divided by languages, then by sub-topics, the custom in forums PRC is to speak the language of the forum where we post, thank you for staying in French on this forum, and reserve English for the English PRC forums.

    Also, I’m editing your message to put the code listing in the correct format, but thanks for future messages to use the <> button on the message editor toolbar to insert code in PRT format.

    Nicolas thanked this post
    #48923 quote
    Nicolas
    Keymaster
    Master

    @Frytconcord

    Thank you for respecting some classic rules: posting in the right place and in the right language! This allows me and the moderators to focus on the answers rather than the household! 👿

    Now, about your question, this ‘trailing stop’ function is not the “SET STOP TRAILING” instruction of the programming language, it simulates it, so it can be used in limited risk account with these limitations:

    The minimum stop distances are greater than the “Expert” accounts (current normal account), the information of this distance can be found in the instrument’s manual trading information (expressed in points or percentage for shares). Since the trailing stop will not work, the SET STOP TRAILING instruction will be inoperative, so I advise you to use the coded trailing stop you find in the blog part of the site (many strategies already use it in the code library ). The stoploss can be far from the entry price, far enough, but you have to take into account your margin required to place it (of course you can not lose more than the size of your cash account, so be vigilant at level of the stoploss).

    #48945 quote
    Frytconcord
    Participant
    New

    Oh! sorry I did not understand the forum. Sorry

    “The minimum stop distances are greater than the “Expert” accounts (current normal account), the information of this distance can be found in the instrument’s manual trading information”

    or find this information?

     

    if I understand correctly it will work you who has it? I do not need to modify it for this:

    Updated version of trailing SL

    #48955 quote
    Frytconcord
    Participant
    New

    sorry, but do you the code trailing stop? I found a lot in the library all different ! Thank you

    #48960 quote
    Frytconcord
    Participant
    New

    @Nicolas
    “The minimum stop distances are greater than the “Expert” accounts (current normal account), the information of this distance can be found in the instrument’s manual trading information (expressed in points or percentage for shares). Since the trailing stop will not work, the SET STOP TRAILING instruction will be inoperative, so I advise you to use the coded trailing stop you find in the blog part of the site (many strategies already use it in the code library ). The stoploss can be far from the entry price, far enough, but you have to take into account your margin required to place it (of course you can not lose more than the size of your cash account, so be vigilant at level of the stoploss).”

     

    Oh! sorry I did not understand the functioning of the forum. sorry
    I find but I can not find any information. Or find this information?

     

    If I understand correctly, I do not need to change the code?
    Or should I add that:

    Updated version of trailing SL

    thanks for your understanding

    #48990 quote
    Frytconcord
    Participant
    New

    @Nicolas

    Should i use this code ?

    #48992 quote
    Frytconcord
    Participant
    New
    defparam cumulateorders = false
    
    //order launch (example) would be set to any other entry conditions
    //c1 = close>close[1]
    c2 = close<close[1]
    
    //if c1 then
    //BUY 1 LOT AT MARKET
    //SET STOP PLOSS 50
    //endif
    
    if c2 then
    SELLSHORT 1 LOT AT MARKET
    SET STOP PLOSS 50
    endif
    
    //************************************************************************
    //trailing stop function
    trailingstart = 20 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
     newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
     IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
      newSL = tradeprice(1)+trailingstep*pipsize
     ENDIF
    //next moves
     IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
      newSL = newSL+trailingstep*pipsize
     ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
     IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
      newSL = tradeprice(1)-trailingstep*pipsize
     ENDIF
    //next moves
     IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
      newSL = newSL-trailingstep*pipsize
     ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
     SELL AT newSL STOP
     EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************
    
    GRAPH newSL as "trailing"
    #49003 quote
    Nicolas
    Keymaster
    Master

    I dot not have a limited risk account myself, but I believe that as long as your pending STOP orders is far enough than the current price (the required points distance from the Close), it should work.

    #49008 quote
    Frytconcord
    Participant
    New

    thanks for your response nicolas. just a small question. the stop at 50 is far enough away for you? otherwise I use the trailing stop with parameters 9 and 10 see below

    #49009 quote
    Frytconcord
    Participant
    New
    //trailing stop function
    trailingstart = 9 //trailing will start @trailinstart points profit
    trailingstep = 10 //trailing step to move the "stoploss"
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

Limited risk account question about trailing stop


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 10 replies,
has 3 voices, and was last updated by Frytconcord
8 years, 4 months ago.

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