Hello i want help with automatic trade
distance to ma50 in 3 minute graph. buy when price is 50 pips from ma50 and sell when it touches ma50 both long and short
There you go:
ma50 = average[50,0](close)
IF Not OnMarket THEN
IF close <= (ma50 - 50*PipSize) THEN
BUY 1 Contract at Market
ELSIF close >= (ma50 + 50*PipSize) THEN
SELLSHORT 1 Contract at Market
ENDIF
ENDIF
IF LongOnMarket THEN
IF high >= ma50 THEN
SELL at Market
ENDIF
ELSIF ShortOnMarket THEN
IF low <= ma50 THEN
EXITSHORT at Market
ENDIF
ENDIF
graphonprice ma50 - 50*PipSize AS "Long trigger" coloured("Green")
graphonprice ma50 + 50*PipSize AS "Short trigger" coloured("Red")
you may either comment out or remove the last two lines if you don’t need them.
Thank you so mutch. I thought the last 2 lines were very good and useful. so I have a question for you if you can code so I take inputs on them instead? buy when the lowest price of the bar crosses below the green line and short when it crosses up the red
What is the green line, how is it formed?