Automating moving average cross strategy

Created at 04 Jul 2023, 18:27
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
TH

thamiembonambi

Joined 02.07.2023

Automating moving average cross strategy
04 Jul 2023, 18:27


Hi I have no prior knowledge of coding but I want to integrate my tradingview strategy to ctrader by creating a cbot and automating my trading. These are the parameters:

XAUUSD (4 Hour) on a Heikin Ashi chart with a moving average 9 (1 confirmation bar). Postions are opened/closed when the moving average crosses a candlestick body (Heikin Ashi) with an initial volume of 0.01.

here is the code from pinescript:

//@version=5

strategy("MovingAvg Cross", overlay=true)

length = input(9)

confirmBars = input(1)

price = close

ma = ta.sma(price, length)

bcond = price > ma

bcount = 0

bcount := bcond ? nz(bcount[1]) + 1 : 0

if (bcount == confirmBars)

    strategy.entry("MACrossLE", strategy.long, comment="MACrossLE")

scond = price < ma

scount = 0

scount := scond ? nz(scount[1]) + 1 : 0

if (scount == confirmBars)

    strategy.entry("MACrossSE", strategy.short, comment="MACrossSE")

//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)

 

Please help me create a cbot with these parameters.


@thamiembonambi
Replies

PanagiotisChar
05 Jul 2023, 08:16

Hi there,

If you would like to assign the job to someone, feel free to contact me at development@clickalgo.com

Aieden Technologies

Need help? Join us on Telegram

 


@PanagiotisChar

... Deleted by UFO ...