Partially Close Trades Example
-
Hi, I am looking for a way to close part of trade if it reaches 50 pips below opening price and keep closing that amount every time it crosses back over the 50 pips line. I can't figure out why this example isn't working correctly:
http://fxdreema.com/shared/RgiqFCLkc

......
ScreenClip.png
ScreenClip.png -
Because one counter is used to control multiple trades, for this array is needed. I think there is no way to do this with existing blocks, and I don't have some great idea which is the easiest way to do it otherwise, but I can think about it

-
thank you, I have been sitting on this puzzle for 12 hours. It's the last piece to finish my ea

-
I'm not sure if this will work, but you can try it. Create a new custom block with this content:
if (FXD_BREAK==true) {return;} LoopedResume(); static int memory[]; bool next=false; int ticket=OrderTicket(); if (InArrayI(memory,ticket)==false) { ArrayValueI(memory,ticket); next=true; } if (next==true) {~next~} else {~inext~}This is modified "once per trade/order" that should work once per trade... really, I mean - once for each trade, even for those that are result from partial close.
If this works, I can add some option in "once per trade/order" that will make you choose to consider partial closed trades as a single trade or as independent.
-
great, thanks - I'll check it out next week (I figured out a workaround using about 100 blocks but your solution would make it a lot cleaner!)