Stochastic and EMA

Hi,

Could you please make a code for the following strategy:

Entry Strategy:

  1. In the 30 Minute Chart, the Stochastic should be bullish.
    (That is, the fast stochastic line should have crossed over the slow line. It does not matter how long ago the crossover took place, it should just be above the slow line and should be going upwards).

  2. In the 5 Minute Chart, the Stochastic should be bullish as well.
    (Fast stochastic line should have crossed over the slow line and should be moving upwards. It should not be in overbought condition yet, that is, it should not have crossed 80 yet).

  3. The 5 Period EMA crossed over the 13 Period EMA from below and moves upwards.

When all three conditions are met, it should generate a buy signal.

Sell Strategy:

  1. In the 30 Minute Chart, the Stochastic should be bearish.
    (That is, the fast stochastic line should have crossed below the slow line. It does not matter how long ago the crossover took place, it should just be below the slow line and should be going downwards).

  2. In the 5 Minute Chart, the Stochastic should be bearish as well.
    (Fast stochastic line should have crossed below the slow line and should be moving downwards. It should not be in oversold condition yet, that is, it should not be below 20 yet).

  3. The 5 Period EMA crosses below the 13 Period EMA and moves downwards.

When all the three conditions are met, it should generate a sell signal

PS Stochastic Setting is 8,3,4 for this system.

Exit Strategy for Buy:

When fast Stochastic reverses from it’s upward move and crosses the slow line from above.

Exit Strategy for Sell:

When slow Stochastic reverses from it’s downward move and crosses the slow line from below.

Thanks in advance.

Best,

Keith

Time? It is my dream all time frame exists in one chart, but as of now it remain as a mystery. I never seen such thing in any trading platform. I usually do it manually, watching 3 time frame with 3 different chart. Your thought as a trader is really encouraging one. As far as coding concerned it may be possible in future if Pi like trading platform expands.

Above you have given two time frames 30 min and 5 min as of now we can not write code on different time frames in tradescript as per condition. please verify your condition once again.

As per the above  modified condition

Buy Script:

SOPK(9, 3, 9, SIMPLE) > 80 OR SOPD(9, 3, 9, SIMPLE) > 80 
AND CROSSOVER(EMA(CLOSE,5),EMA(CLOSE,13))

Sell Script:

SOPK(9, 3, 9, SIMPLE) < 80 OR SOPD(9, 3, 9, SIMPLE) < 80 
AND CROSSOVER(EMA(CLOSE,13),EMA(CLOSE,5))

@algogeek could you please help me out with this?

Thanks Peter, your response makes me feel like I’m on the right track :slight_smile: Can you help me out here with something that can partly substantiate my strategy? I’m open to trying out some input that you might have to make this better or something new altogether.

Hi Sreeni,
I’ve made the required change in the strategy:
Buy Entry:

  1. In the 5 Minute Chart, the Stochastic should be bullish as well.
    (Fast stochastic line should have crossed over the slow line and should be moving upwards. It should not be in overbought condition yet, that is, it should not have crossed 80 yet).
  2. The 5 Period EMA crossed over the 13 Period EMA from below and moves upwards.
    When both the conditions are satisfied, it should generate a buy signal.
    Buy Exit:
    When fast Stochastic reverses from it’s upward move and crosses the slow line from above.
    Sell Entry:
  3. In the 5 Minute Chart, the Stochastic should be bearish as well.
    (Fast stochastic line should have crossed below the slow line and should be moving downwards. It should not be in oversold condition yet, that is, it should not be below 20 yet).
  4. The 5 Period EMA crosses below the 13 Period EMA and moves downwards.
    When both the conditions are satisfied, it should generate a sell signal.
    Sell Exit:
    When slow Stochastic reverses from it’s downward move and crosses the slow line from below.
    Best,
    Keith

please check above modified answer

Sir can please provide this strategy in AFL code

Hello AlgoGeek
I really need your help or if you can get me the script for the following on the hourly chart of 60 candle.,
Buy: when Stochastic oscillator cross over at the bottom
Sell: when stochastic oscillator cross over at the top
and i should be able to run this script on all FNO-stock to find the list of stocks which are meeting the criteria.
I would remain thankful to you for the same.
Regards
Chandan thakur
RC1404