Not logged in
Viewing 15 posts - 1 through 15 (of 19 total)
  • #113786 |
    Participant
    13 Posts

    Hi, 

    I am trying to do this:

    if OpenProfit(magicBuy) > Variable1 then

     Move SL to  CurrentPrice – Variable1 and

     MoveTP to min(currentPrice+TP + Variable2,CurrentPrice+MaxTP) (ie. if maxTp is reached  I close the order)

    .

     How is this accomplished?

     

    I attach a sample SQW for your consideration…

     

    Please consider that MagicNumbers are variables as the EA could run on different Pairs.

     

    Thanks a lot,

     

    Claudius

    Attachments in this forum are visible only for registered users.
    #130837
    Moderator
    1559 Posts

    Hi,

     

    if you just want to move SL when OP (Variable1) reaches certain amount of money/pips I would use MoveToBreakEven function for the entry order since your condition actually moves it to break-even.

    Bit confused about variable you use for profit-target. How is ‘Variable2’ used and calculated? I cannot see it in your sample. Can you verbally describe behavior of the profit-target so I can suggest rules for that?

    #130887
    Participant
    13 Posts

    I thought could be easier to explain it graphically… Please have a look at the attached  sketch.

     

    Thanks,

    Attachments in this forum are visible only for registered users.
    #130949
    Moderator
    1559 Posts

    Hi,

     

    I am still not sure if I get right so:

    1) you enter to a long position and set the Initial PT + Initial SL

    2) when price moves X pips you move SL to a new price

    3) you also move PT to a new price

     

    Now I am not sure what this means ‘Close order if initial TP reaches max TP’? Can you give me real life example using some abstract prices? How can Init PT reach Max PT? Are Max PT & Init PT fix values?

    #130961
    Participant
    13 Posts

    Thanks for the reply.

    Exactly!! Both SL and initialTP move with the price movement.

    Initial Take Profit is set ,say, to 70 pips and maxTP to 200 pips.

    As we move InitialTP to a new price, if it reaches the maxTP (200 pips) the order is closed.

    I hope this is clear!

     

    Thanks,

    #131054
    Moderator
    1559 Posts

    hi,

     

    created a strategy example for you which does following:

     

    1) enters into a long position and sets SL to 40 pips and PT to 40 pips

    2) when position gets into profit > 0, trailing SL is being activated so with each additional pips of profit (x), your SL is moved higher by X pips so new SL is always kept 40 pips from max open profit price and max loss is limited then to 40 pips

    3) with each additional pip into profit, your initial PT is also moved to a higher price

    4) when PT moving higher reaches max PT (in this case 80 pips), position is closed

     

    Is this what you wanted?

    Attachments in this forum are visible only for registered users.
    #131141
    Participant
    13 Posts

    Thanks,

     

    We are heading in the right direction!!!

     

    The only problem I cannot clone your strategy with different MagicNumber – MagicNoSell….

     

    Could you please have look?

     

    Thanks,

     

    Attachments in this forum are visible only for registered users.
    #131150
    Moderator
    1559 Posts

    Hi,

     

    I added and tweaked conditions for short side too. Look at file attached.

    Attachments in this forum are visible only for registered users.
    #131164
    Participant
    13 Posts

    Thanks,

     

    Tried to use the file you attached, but it cannot be saved as Expert Advisor, giving a lot of error exceptions… 

     

    Please see attached .

     

    Thanks

    Attachments in this forum are visible only for registered users.
    #131188
    Participant
    13 Posts

    Thanks !!

     

     It seems I needed the update to get it correct!

     

    Thanks.again.

    #131355
    Participant
    13 Posts

    Hi,

     

    I tried to clone your “Adjust PT – Buy” Rule to a new “Adjust SL – Buy” by:

     MoveSLTo:

     Magic Nuber : MagicNoBuy

     Price : openPrice(MagicNoBuy) + ConvertPLToRealPips(OpenPL(MagicNoBuy))))

    On entering the last line I always get “Property Value is not valid” error….

     

    (MovePT is left there so that I can copy what I want …!)

     

    What do I do wrong ????

     

    Please see attached..

     

    Thanks,

     

     

     

     

     

    Attachments in this forum are visible only for registered users.
    #131484
    Moderator
    1559 Posts

    Is this what you wanted?

     

     

    Attachments in this forum are visible only for registered users.
    #131506
    Participant
    13 Posts

    Yes, Thanks.

     

    Just tried to clone this for “Adjust SL- Sell” but could not change MagixNoBuy to MagicNoSell, neither change addition to subtraction ….

     

    Also tried to enter conditions for Close Order For StopLoss (Current PRice Falls below NewSLPrice) for both Buy and Sell, but the program did not accept my formulas… For example when I try to change MagicNoBuy to MagicNoSell, I can only change magicNo from 1000 to 1001 + or 999 -… What am I doing wrong with formula entry?

     

    Thanks,

    Attachments in this forum are visible only for registered users.
    #131556
    Moderator
    1559 Posts

    hi, will check the file you attached

    #131616
    Moderator
    1559 Posts

    You can change MagicBuy to MagicSell easily. You have to just “double-click” through conditions since they are nested into each other. For example in Adjust SL – SELL double click on NewSLPrice then on “Value” line click on “…”, then click again on “…” on the Parameter1 line where you can change the magic number. Then you can do the same for Parameter2.

     

    Can you somehow post a screenshot of how you compose the formula?

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

You must be logged in to reply to this topic.