Dynamic Take Profit on Moving Average
-
Hi everyone,
I have activated 1 market order and 2 pending orders using buttons, and I’d like to close all positions related to that chart based on a moving average that updates with each tick.
I tried adding the condition and the order closure in the "on tick" section, but it doesn't work.
Does anyone have a solution to suggest?
Here the project: https://fxdreema.com/shared/0rsyjbKlb
Thanks!
-
The problem will be with == price will rarely = an MA price because of the relevant tick causing the price recognition level to skip past it at the relevant microsecond, try using a cross setting (x> or x<)
-
@jstap you mean 2 logic tree on "on tick" one for buy and one for sell like that but with > and <?
-
Yes but a cross x> x< happens once, not constantly
-
ok thanks @jstap , now it works!! This is the update version https://fxdreema.com/shared/XmMIN77kc
Now to test it on tester i put a PASS block over the 2 flow on "on tick" but the buttons doesn't work on tester...
-
On chart won't work on tester, for this, you need to use on tick, condition block, object on chart, button pressed/depressed == 1 - buy/sell (complete action)block - redraw button off
That would mean you can use the button drawn on init in backtest ensuring it is switched back off if used