São Paulo + Brazil
Posts: 4 since Jul 2020
Thanks Given: 0
Thanks Received: 1
|
Hello everyone,
I'm a Thinkorswim user, and I'm using MACD to give me buy and sell signals.
When MACD() "Value" crosses above "MACD() "Avg", it triggers a buy order.
I'm trying to create a code to trigger a sell order when MACD() "Value" is below "MACD() "Avg", after a buy order (that will be after a crossing above), but after a while. Because sometimes MACD will cross above and, with fluctuation, it will then go below again, so I need a way to confirm that it will not keep above and has to be sold, not hold.
I was thinking something like a code to trigger a buy order when MACD() "Value" is below "MACD() "Avg" on the closing of the current bar, or on the opening of the next one.
But the code can be anything simple that, after some time (like 1 bar duration), will trigger a sell order if it MACD() "Value" doesn't manage to keep itself above MACD() "Avg".
I hope it was easy to understand, does anyone know how to solve this?
Thank you.
|