Pointsize? problem when setting SL

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #90153 quote
    PastaPesto
    Participant
    Veteran

    Hello!

    Im testing a code to set my SL just below “swing low” when going long. This code seems to work the way I want to on DAX, but when testing it in Forex I just cant get it to work properly. I tried to use “pointsize” but I just cant get it to work the way it does in DAX. The problem is that it just closes the order directly with SL or TP. With *pointsize it goes a bit longer but not even close to where it should.

    Below a simple code just to show in a simple way the way it works.

    //Test SL from low
    Defparam cumulateorders = false
    N=10
    TPP=1.5//risk/reward
    extra=15//pips below Low for SL
    
    C1 = ExponentialAverage[3](close)
    C2 = ExponentialAverage[20](close)
    
    IF c1 crosses over c2 THEN
    Low1=LOWEST[5](low)//lowest point of the 5 recent candle
    SL= (close-LOW1)+extra//Lowest + 15 extra pips under
    TP= SL*TPP//Risk/reward
    BUY N/SL SHARES at MARKET
    Set target pprofit TP
    SET STOP pLOSS SL
    ENDIF
    #90154 quote
    robertogozzi
    Moderator
    Master

    Try

    SL= (close-LOW1)*pipsize+extra//Lowest + 15 extra pips under
    #90194 quote
    PastaPesto
    Participant
    Veteran

    Thanks Roberto for your reply,

    I still dont get it to work. example pic from GBPUSD where it doesnt work and another from DAX where it looks ok. On Dax it only works without Pipsize and on GBPUSD it doesnt work with or without. Do I need to add pipsize anywhere else?

    Skärmklipp-SL.jpg Skärmklipp-SL.jpg Skärmklipp-SL-Dax.jpg Skärmklipp-SL-Dax.jpg
    #90216 quote
    robertogozzi
    Moderator
    Master

    If you add 15 to GbpUsd you’ll reach around 16.3 which will NEVER be true.

    You’ll have to convert also the other value to pips:

    extra=15 * pipsize //pips below Low for SL

    I forgot to write it in my previous answer, sorry.

    PastaPesto thanked this post
    #90396 quote
    PastaPesto
    Participant
    Veteran

    Ok, everything is working now. I actually had to divide with pipsize at pairs where the the number was lower than 1 (ex 0.002) .  I also had to do it at the “extra” as you mentioned Roberto.

    Thank you Roberto, Grazie Mille!

     

     

    SL= (close-LOW1)/Pipsize+extra//Lowest + 15 extra pips under
    Paul thanked this post
    #90405 quote
    robertogozzi
    Moderator
    Master

    Sorry, it was DIVIDE, you’re right!

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

Pointsize? problem when setting SL


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
PastaPesto @pastapesto Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzi
7 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/31/2019
Status: Active
Attachments: 2 files
Logo Logo
Loading...