Not logged in
Viewing 15 posts - 1 through 15 (of 25 total)

Forums>AlgoWizard / EA Wizard>General Discussion>Stop below low of previous candle

  • #112031 |
    Participant
    38 Posts

    Hi

     

    Can anyone help with how I tell EA Wizard to place a stop loss below the low of the 2nd candle back?

     

    Thanks

     

     

    #123987
    Participant
    38 Posts

    So how do you learn this stuff without a manual or forum replies?

    #124020
    Mark Fric
    Administrator
    1182 Posts

    Hello,

     

    this is relatively simple.

    You only have to set SL to be at specific price level (in Stop Loss dialog) and choose Low with Shift=2.

     

    Low[2] means low of candle 2 bars ago.

     

    I’m attaching a sample strategy, I added also configurable offset in pips to set SL few pips below the Low.

     

    For that I used variable SLOffsetInPips and function ConvertToRealPips that will convert pip value to “real” pips according to the symbol traded.

    Attachments in this forum are visible only for registered users.

    Mark
    StrategyQuant architect

    #124022
    Participant
    38 Posts

    Thats great thanks.

     

    How can I set the Take profit to be a multiple of the size of the stop loss?

    #124024
    Mark Fric
    Administrator
    1182 Posts

    in a similar way, but you have to use formula to compute the actual SL (Ask – SL level).

     

     

    Attachments in this forum are visible only for registered users.

    Mark
    StrategyQuant architect

    #124025
    Participant
    38 Posts

    Thanks, can you tell me briefly what the settings mean in the variables..

     

    1.  Int

    2.  Double

    3.  Boolean

    4.  String

     

    Thanks.

    #124027
    Mark Fric
    Administrator
    1182 Posts

    Int – integer number, for example 1 – 100000

    Double – decimal number – 0.23, 4.67, 10234.56

    Boolean – true/false value

    String – text string

    Mark
    StrategyQuant architect

    #124030
    Participant
    38 Posts

    Very helpful, thanks.

     

    Im trying to get my head around the Take profit multiplier.  is it like this:

     

    1.  Assign variable to  get Stop loss in pips   (open ask – low shift 3)

    2.  Assign variable to get the take profit in pips  ( stop loss in pips  *  e.g 2)

    3.  Set TP to Ask price + take profit in pips.

     

    Is that right?

     

    And, do I need to convert 2 into real pips?

     

    Thanks.

    #124031
    Mark Fric
    Administrator
    1182 Posts

    Hello,

     

    in my example it was like this:

     

    1. compute the correct Stop Loss level: Low with shift=2 – X pips offset and storing it to value SLLevel

     

    2. Create order, set SL to 

     

    You should realize that SL computed in step 1 is a price level, for example 1.6432.

    To get SL in real pips you should deduct it from the price at trade open, hence Ask – SL.

    For example  let’s say Ask price is 1.6510, then Ask – SL will be 0.0078. This is in “real” pips.

     

     

    I realized that I made one mistake – for PT I had to use function ConvertToPips() that converts value from real pips to pips.

     

    ConvertToPips(0.0078) = 78 pips

     

    Then you can set PT = 2 * this value = 2 * 78

     

    I’m attaching corrected strategy.

     
    Attachments in this forum are visible only for registered users.

    Mark
    StrategyQuant architect

    #124032
    Participant
    38 Posts

    Can you explain

     

     

    ….   – X pips offset.

     

    what does that mean?

     

    Thanks

    #124033
    Participant
    38 Posts

    How do you attach a file here?  I can’t see it!

    #124035
    Participant
    38 Posts

    Found the attach, you have to use the reply button.

     

    Please could you have a look at the attached strategy and tell me what I’m doing wrong with the TP being a multiple of the SL.

     

    Thanks

     

    Attachments in this forum are visible only for registered users.
    #124036
    Participant
    38 Posts

    Its ok, ive cracked it.  Just done it.  Thanks for your help.

    #124037
    Participant
    38 Posts

    one more on this topic..

     

     

    If my stop is below the low of shift 2.  How can I make it e.g 3 pips below that low?

    #124071
    Mark Fric
    Administrator
    1182 Posts

    If my stop is below the low of shift 2.  How can I make it e.g 3 pips below that low?

     

    I made this in my example – you can use functions +, -, *, / in EA Wizard.

    So to get price level at 3 pips below the Low you can use formula: Low[2] – ConvertToRealPips(3)

     

    You should use function ConvertToRealPips() so that your pips value is converted to the correct price value that can be deducted from Low.

    Mark
    StrategyQuant architect

Viewing 15 posts - 1 through 15 (of 25 total)

You must be logged in to reply to this topic.