Hi im looking for some help to put a automated code together
BUY ORDER
If EMA 10/25 is BELOW Dounchain Channel Middle THEN place BUY order when candle stick hits Dounchain Channel DOWN. Close order when NEXT candle Stick hits EMA 10
SELL ORDER
If EMA 10/25 is ABOVE Dounchain Channel Middle THEN place SELL order when candle stick hits Dounchain Channel UP. Close order when NEXT candle stick hits EMA 10
Moderator edit: please don’t share personal information on forums. Thanks.
Hi,
>> Please update your country flag in your profile. Thank you 🙂 <<
Topic moved in automatic trading forum.
Hi done – can you help with the code?
that should read donchain not dounchain
Here is the code for your
Donchian automatic trading strategy:
DEFPARAM CumulateOrders = False
donchianperiod = 20
// indis
hh = highest[donchianperiod](high)
ll = lowest[donchianperiod](low)
mid = (hh+ll)/2
ema10 = exponentialaverage[10]
ema25 = exponentialaverage[25]
// trading
if ema10>mid and ema25>mid then
buy 1 contract at hh stop
endif
if ema10<mid and ema25<mid then
sellshort 1 contract at ll stop
endif
// exit trigger
if longonmarket then
sell at ema10 stop
endif
if shortonmarket then
exitshort at ema10 stop
endif
You did not tell what would be the Donchian channel period, so I made it as a variable you can change (default is 20 periods).
I’m looking for similar help. Is it possible to share code so I can OPEN a short position if price crosses Upper Donchian Channel THEN close order when it crosses Donchian Lower Channel (only one order open at any one time)? I can use this when there is a strong downward trend -thanks.