Not logged in

Forums

Viewing 7 posts - 1 through 7 (of 7 total)

Forums>EA Wizard>General Discussion>Help for close position partially

  • #200785 |
    Participant
    21 Posts

    Hello

    Please I will apreciate if you may help me.

    I want to close a position (long or short) partially when it is on profit when the price is at X% of TargetProfit. For example

    If

    Is Bar Open is True

    AND MARKET POSITION IS LONG

    AND Condition (Price, Indicator, etc.) > OpeningPrice+ConvertToRealPIPS((X/100)*TP), then ClosePartially (Order, Quantity)

    My EA is making it well sometimes and it closes partially the position as my condition is triggered.

    After the position partial closing, the condition is evaluated again as a new bar opened and if it is true, the EA closes the postion partially again for the same partial profit.

    So the EA is closing the position partially more times that I was expected for the same TP if the condition is satisfied at each candle.

    What I want is to close partially just one time per condition satisfied.

    I will appreciate whatever suggestion.

    Thanks.

    Attachments:
    You must be logged in to view attached files.
    #200789
    Administrator
    348 Posts

    Hello,

    1. you need to use a “helper” variable. You can call it “partialTPhit” and set it to 0 (zero) by default as well as with opening the initial position using Assign Variable (partialTPhit) = 0.
    2. include this variable into your partial exit condition (IF partialTPhit = 0 AND “your other conditions”)
    3. below the condition add this action – Assign Variable (partialTPhit) = 1. This will prevent additional partial profit taking

    For a next new trade it will be reset to work properly by the assign action set in step #1

    Let me know if you need an example on this

     

    #200791
    Participant
    21 Posts

    Hi tomas262

    Could you be so kind to build an EA as an example? The target is:

    Open Position (TargetProfitInPIPS)

    Close 50% of the initial position at 50% of TP (just one time)

    Close 50% of the current position at 75% of TP (just one time)

    Thanks

    I appreciate it.

    #200807
    Administrator
    348 Posts

    Hello,

    so you have 2 partial profit taking and 1 fixed profit-target order?

    #200814
    Participant
    21 Posts

    Hi tomas262

    Following your suggestion I have been able to get what I want by setting your setp-by-step for each partial close condition.

    My EA has 3 partial TP at 25%, 50% & 75% of TP.

    Thank you so much for your help

    đŸ™‚

    Attachments:
    You must be logged in to view attached files.
    #200843
    Administrator
    348 Posts

    By the way does your strategy perform better when you apply “scale-out” approach using partial targets compared to all-out version? This is an all-time question đŸ™‚

    #200847
    Participant
    21 Posts

    I have found that the trades using the full TP take a long time open. It means less number of trades for the strategy and loosing some oportunities that maybe are more profitable. So I am checking what happens if I close partially the position one or more times with a limit for the number of bars since the position was opened.

    Thanks for your help

    đŸ™‚

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.