TradingView
GlobalMarketSignals
3 Mar 2020 pukul 00.36

GMS: Moving Average Crossover Strategy 

SPDR S&P 500 ETF TRUSTArca

Deskripsi

This is a moving average crossover system built the way I would want it to be.

- The moving averages included are SMA, EMA, WMA, VWMA.

- You can select either for the first moving average or the second moving average.

- You can also select to see the Long trades, Short trades, or both at the same time.

- There is also a simple moving average trend filter. When this is selected, it only applies to the entries of a trade and not the exit. There are situations where the entry is above the trend filter and the exit is below.

The source code should be open so feel free to adapt it, make it more efficient, or take some part for your own project!

I hope it helps,

Andre

Catatan Rilis

I just added in a % profit target and % stop loss. Each has an on/off switch so you can test each other together or independently!

Also changed the name in the strategy part of the code.

I hope it helps,

Andre
Komentar
GlobalMarketSignals
In relation to this part of the description...

"- There is also a simple moving average trend filter. When this is selected, it only applies to the entries of a trade and not the exit. There are situations where the entry is above the trend filter and the exit is below."

This also applies vice-versa, there are also situations when the entry is below the trend filter and the exit is above.
adelinyahoo
Can you please help me with the line of code to make this automated. As it is written now, the long and short order size is the same so if you automate this , let`s say you go long 100 $, then when the short signal will come it will be short 100$ and will cancel out, instead of placing a 200$ order to equal -100$ or automatically close the long order and open a short one.
GarethSA
MY MA LINES DON'T SHOW?
Lebih lanjut