Welcome to the BEST forum for traders

Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".

Strategy based on Stoch data from multiple timeframes

Oct 2, 2020 - 1:24 AM

Viewed 420 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/20181 COPY
  • Hi traders, I'm trying to backtest my strategy based on checking Stochastic data from multiple timeframes but I have no idea how to achieve this, please help!!

    Here is an example scenario:
    If Sto %K of '5m' is greater than or equal to 'xx%' AND Sto %K of '15m' is greater than or equal to 'xx%' open a 'Long' order

    1
  • Hi there

    I'd do like this

    res5 = "5"
    res15 = "15"
    
    f_rsi_stoch(_src, _rsi_length, _stoch_length, _k_length)=>
        _rsi = rsi(_src, _rsi_length)
        _stoch_rsi_k = sma(stoch(_rsi, _rsi, _rsi, _stoch_length), _k_length)
        _return = security(syminfo.tickerid, res, _stoch_rsi_k)
    
    stoch_rsi5 = f_rsi_stoch(close, res5, smoothD, smoothK)
    stoch_rsi15 = f_rsi_stoch(close, res15, smoothD, smoothK)
    
    // example with 10%
    condition_bull = stoch_rsi5 >= 10 and stoch_rsi15 >= 10
    
    if condition_bull
      strategy.entry(...)
    
    
    1

    Dave - Helping traders becoming the best version of themselves
CONTENTS