TradingView
fikira
8. Mai 2020 19:25

Strategy Tester EMA-SMA-RSI-MACD 

Bitcoin / DollarBitfinex

Beschreibung

On Tradingview I never saw a custom adjustable strategy script yet, so this is it,
you can change different things and see if you'll get a good strategy or not

Settings:

First choose the source, you can choose out of:
close, open, high, low, ohlc4, hlc3, hl2

Then choose you strategy: Long & Short, Long only or Short only

Next, choose your entry "Buy/Long" (which is the "close Short position" when "Short"):
- (E)MA 1 > (E)MA 2 (Each can be made ema or sma)
- close above (E)MA 1
- RSI strategy
- macd > signal
- macd > 0
- signal > 0

Then choose your RSI values if needed (for example you want a trigger when EMA 1 > SMA 2
but only if RSI > 60, then change "IF RSI >" from 0 to 60

Next you can choose an extra argument
and even a second argument with Higher Time Frame settings

Under this you can change your (E)MA values as desired (HTF values, MACD and RSI length can be found lower)

All the same with the exit/close (or if "Short", this is your entry)
Again, change everything as you wish

Then comes the RSI length setting, MACD settings and HTF settings, followed by SL/TP settings
(you also can enable/disable SL/TP), and TIME settings (for example you want to know the profit only from this year)

Alerts are provided in next script

Have fun!

Versionshinweise

Updated the RSI arguments

Versionshinweise

Improved SL/TP, thank you finetime1000 for spotting !

Versionshinweise

Added debugging

Also added symbols when it triggers (at close),
the strategy order will then happen at open (next bar),
just to help seeing how it works

Versionshinweise

Added SELL a condition,
if the option "BUY = false" is chosen, it will SELL whenever 1 of more BUY conditions isn't valid anymore

Versionshinweise

Source is now more adjustable, when combined with a second, third,... script, you can use the source of that second,... script in the Stat-test

Versionshinweise

Added as extra argument 'hist > hist[1]' (when 'hist' < 0) or 'hist < hist[1]' (when 'hist' > 0).
When you want this option solely as strat, you could for example choose (BUY & SELL):
'RSI' strategy (values 0 & 100, so it never will be triggered), and 'extra argument' -> hist...

Versionshinweise

Synchronized with recent pine changes

Versionshinweise

updated
Kommentare
raincolle
I am attempting to add this to my chart but when I click to add it says there is an issue and to please try again later, yet I can click and add any other strategy you have with no problem.
fikira
@raincolle, Hi, thank you for reporting, I seem to have the same problem, though I haven't altered the script and it worked before as it should be.
I will ask the Tradingview helpdesk, thank you very much!
Regards
raincolle
@fikira, Glad I could help. Your work looks great. I look forward to trying out this strategy in concert with your Strat Test Alert. Could you let me know where this matter gets sorted out? I would greatly appreciate it.
fikira
@raincolle, Will do ;)
raincolle
@fikira, Thanks. Looking forward to it.
fikira
@raincolle, Thanks, it would appear it is solved! Please try it again, thanks!
CreatedMatter
Question for you fikira,
What does turning on the "recalculate after order is filled" switch do? I notice the cumulative profit total is considerably higher when I turn this on.

Thanks for your work on this script!
LoveContagion
Hi @fikira, I love your Strategy tester! Will it be possible to add Leverage calculations for Leveraged Trades? Thank you! :)
fikira
@jessnarsinues, No, sorry...
Mehr