TradingView
QuantNomad
Mar 25, 2018 11:04 AM

Kozlod - 3MA strategy with SL/PT (7 MA types) 

Apple Inc.NASDAQ

描述

Classic 3 MA strategy.

  • Long - Short MA crossover Medium MA and cross is above Long MA
  • Short - Short MA crossunder Medium MA and cross is below Long MA


You can choose one of these MA types in params:
Simple Moving Average ( SMA )
Exponential Moving Average ( EMA )
Weighted Moving Average ( WMA )
Hull Moving Average ( HMA )
Volume-weighted Moving Average ( VWMA )
Smoothed Moving Average ( SMMA )
Double Exponential Moving Average ( DEMA )

You can select SL/PT % levels.
评论
mych36
Did a quick test on some other other hot ticker symbols and wasn't seeing that great of results. Have you tested this out in live trading?
Princecrypto
Hi, Do you have this in version 4?
QuantNomad
@Princecrypto, not yet, will convert it when will have some free time.
Princecrypto
@QuantNomad, Thank you! Is there a way you can get the version 4 created to select each MA crosses , eg :- short MA and Long MA , short MA and Medium MA , so on.. Instead of 3 then the script will have the option to select 2 MA.
foudid
thanks for the work ! Is that possible to remove the backtesting ?
Keeping the inputs only without backtesting

Thanks
QuantNomad
@foudid, hi. what do you mean? Do you want a study with alerts?
foudid
@QuantNomad, Yes, only the alerts without all the information on the backtesting. Keeping the settings to choose which ema etc and having only the plots.

In meantime, I have added the inputs to choose from when to back test :

// date
FromMonth = input(defval = 9, title = "From Month", minval = 1, maxval = 12)
FromDay = input(defval = 1, title = "From Day", minval = 1, maxval = 31)
FromYear = input(defval = 2018, title = "From Year", minval = 2017)
ToMonth = input(defval = 1, title = "To Month", minval = 1, maxval = 12)
ToDay = input(defval = 1, title = "To Day", minval = 1, maxval = 31)
ToYear = input(defval = 9999, title = "To Year", minval = 2017)

// function
start = timestamp(FromYear, FromMonth, FromDay, 00, 00)
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59)
window() => time >= start and time <= finish ? true : false

and added this function on the strategy.entry and close

Everything is working perfectly ! : )
foudid
@QuantNomad, And yes a study alert in a good words of dev here
foudid
@foudid, have modified this :

//////////////
// PLOTTING //
//////////////

plotshape(short_signal, title="SHORT", style=shape.triangledown, color=red, text="short")
plotshape(long_signal, title="LONG", style=shape.triangleup, location=location.belowbar, color=green, text="long")


//////////////
// STRATEGY //
//////////////

alertcondition(long_signal, title='Buy Signal', message='Buy Signal Alert')
alertcondition(short_signal, title='Sell Signal', message='Sell Signal Alert')

it works for the study.

I don't know if there is something better to do ?
Harleydarocha
This is a great strategy! Such high net profit, am i missing something?
更多