Trading system with EMA, SAR and Stochastic

Forums ProRealTime English forum ProOrder support Trading system with EMA, SAR and Stochastic

  • This topic has 14 replies, 5 voices, and was last updated 7 years ago by avatarLeo.
Viewing 15 posts - 1 through 15 (of 15 total)
  • #48200

    A request that was addressed to ProRealTime:

    Dear Sir or Madame,

    I opened the account via the prorealtime homepage with IG Markets and would kindly like to ask for writing a code for trading system as follows:

    Parameter
    – Currency pair: AUD/USD (or other major pairs)
    – 3 Min Candle Chart
    – EMA 200
    – Parabolic SAR (using the standard setting)
    – Stochastic Indicator (13 ; 8 ; 3) / horizontal lines in the indicator are located at 25 (instead of 20) on the bottom and 75 (instead of 80) on the top
    – Trading Hours 08:05 o’clock German time until 15:25 o’clock German time and 15:35 o’clock until 21:45 o’clock

    Long Order

    • The current candle stick is trading above the EMA 200.
    • Parabolic SAR is plotting below the current candle (green for uptrend).
    • Stochastic is confirming the above with crossing upward (preferably the lines have crossed below the 25 horizontal line already)

    If the above conditions are all fulfilled, then:

    • Buy 0,1 Lot (mini-Lot) with the open of the next candlestick.
    • Stop-Loss is placed 2 pips below the Parabolic SAR.
    • Target is 10 pips (might be changed, just do not know which is the best target at the moment but I assume that amending the target should be possible without difficulties).
    • The Stop-Loss is a trailing stop which should be plotted always two pips below the Parabolic SAR.
    • Position is closed when the price reaches the target or the stop loss.

     

    Short Order

    • The current candle stick is trading below the EMA 200.
    • Parabolic SAR is plotting above the current candle (red for downtrend).
    • Stochastic is confirming the above with crossing downward (preferably the lines have crossed above the 75 horizontal line already)

    If the above conditions are all fulfilled, then:

    • Sell 0,1 Lot (mini-Lot) with the open of the next candlestick.
    • Stop-Loss is placed 2 pips above the Parabolic SAR.
    • Target is 10 pips (might be changed, just do not know which is the best target at the moment but I assume that amending the target should be possible without difficulties).The Stop-Loss is a trailing stop which should be plotted always two pips above the Parabolic SAR.
    • Position is closed when the price reaches the target or the stop loss.

    Trust the above is understandable. If you have any questions please contact me.

    Thank you very much in advance and look forward to hearing from you.

     

    Suggestion for an anwser:

     

     

    #63335

    Bonjour,

    Ce système ne semble pas marcher chez moi sur les actions :

    > que faudrait-il changer (désolé mes connaissances de programmation sont réduites) !

    Merci d’avance !!

    Chris

    #63336
    Leo

    I think is missing the stochastic lines crossing.

    Cross over in the last 5 bars:

     

     

    #63360

    I think is missing the stochastic lines crossing. Cross over in the last 5 bars:

    Line 3 should read

     

     

    #63526

    Hi Roberto,

    Thanks for your answer ; so what would be the full code to deal with stocks ?

    BTW, do you know how to set a timeframe for backtest ?

    Best,

    Chris

    #63539

    Here is the full code:

    When a backtest is launched it uses the current TF on the chart, just change it.

     

    1 user thanked author for this post.
    #63550

    Thanks Roberto for the code and your answer 😉 (I don’t get it; apprently the Trading Systems I tried keep taking M5 for the backtest even if I am on the daily time frame ..;

    I would be interested in your advice for the best automatic trading system you have used on stocks !!

    I am struggling to find one profitable ;

    Are you using this ATS ?

    Best,

    Chris

    #63555

    Sorry, I don’t trade stocks!

    I use ATS only on demo accounts and just a few FX pairs + DAX.

    1 user thanked author for this post.
    #63556

    Roberto,

    Here is what it returns ; what do I need to do ? Thanks !

    #63558

    Leo wrote that line of code assuming you know what to write within brackets, i.e. the number of periods for the Average to be used with Stochastic. Just replace PD with your desidered value. This line of code is with number 3:

     

    #63560

    Hi Roberto,

    Still not working sorry; would you mind checking is in PRT yourself when you have 5 mn?

    Thanks ;

    Chris

    #63562

    On which instrument and TF are you testing it?

     

    #63601

    Results attached  …

    1st image with Pd at 42 – eurusd over 1ok bars on spreadbet @ £1 per point (= mini CFD).

    2nd image with Pd at 16 – Dow / DJI then same as above.

    Looks promising!?

    #63667
    Leo

    Hi,

    There is an error in condition  c3 : it should be crossing value 25.

    Hi Grahal, what is the background when you take the value Pd so high? I have never seen that. Sound interesting.

     

    #63759
    Leo

    Hi GraHal,

    Thanks to your comment, it sparks an idea to me ,I posted in a new forum

    https://www.prorealcode.com/topic/pseudostochastic-trade/

     

Viewing 15 posts - 1 through 15 (of 15 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login