Reply

Help for close position partially

9 replies

josecort_trader

Subscriber, bbp_participant, community, 9 replies.

Visit profile

6 years ago #200785

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.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #200789

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

 

0

josecort_trader

Subscriber, bbp_participant, community, 9 replies.

Visit profile

6 years ago #200791

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.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #200807

Hello,

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

0

josecort_trader

Subscriber, bbp_participant, community, 9 replies.

Visit profile

6 years ago #200814

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.

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #200843

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 🙂

0

josecort_trader

Subscriber, bbp_participant, community, 9 replies.

Visit profile

6 years ago #200847

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

🙂

0

Conmariin

Subscriber, bbp_participant, community, customer, 54 replies.

Visit profile

6 years ago #232880

Is it possible to make an example of this partial closing to understand better what is meant? Thanks a lot! 🙂

 

Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

6 years ago #232934

Hello,

it can be easily done using partial close function

0

Conmariin

Subscriber, bbp_participant, community, customer, 54 replies.

Visit profile

6 years ago #232937

Thanks Tomas! 🙂

That’s really easy! 😉

Automatisches Handeln mit Expert Advisor
https://www.rabenesche.de

0

Viewing 9 replies - 1 through 9 (of 9 total)