Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

madc follwed by stochastic

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    madc follwed by stochastic

    can you please help me out,i am trying to write a strategy in which when macd crosses below macd average followed by a stochastic crossing then i would sell and vise versa for buying.
    when i write the script and back test it i find that that condition only occurs when both the macd and stochastics cross at the same time.i need the macd to cross first followed by stochastic crossing.
    thank you

    #2
    Hello,

    Please post your code so we can assist.

    It sounds like you need to create a bool flag that stays true only if your first condition is met. Then use that flag in your condition to trade with the Stoch. cross condition. This may help:


    if(...conditions for macd cross...)
    {
    macd_cross = true;
    }
    else
    {
    macd_cross = false;
    }

    if(macd_cross && ....stoch cross condition...)
    {
    //trade code
    }
    DenNinjaTrader Customer Service

    Comment


      #3
      macd crosiing followed by stoch

      Ben thank you
      ok here is my strategy that i need to create.
      macd set at 21/55/8 crossing below macd average
      if followed by stochastic(8/3/5) crossing k crosses below d then sell short.
      the stochastic crossing should occur where kand d are above 40% on the stoch range.
      the oposite would be for long.
      i also need to set a time frame for this rom 6am to 11am
      thank you

      Comment


        #4
        Hello,

        I am sorry, you will need to try and code it yourself and post questions. I am happy to help you with specific questions.
        DenNinjaTrader Customer Service

        Comment


          #5
          macd followed by stoch

          ok i coded it myself already but can you please explain in more details about how i can program the stochastic to follow the macd crossing.

          Comment


            #6
            Hello,

            Give it a try using the code I provided below and post the code with an explaination of what it is, or is not, doing. Someone will give you pointers from there.
            DenNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X