Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Possible Crossover Alert

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

    Possible Crossover Alert

    Hello,

    I have a simple strategy based on 2 simple moving average crossover
    Let say we are 1 bar before a possible crossover. Since the moving averages are based on the closing price..the closing price of this bar will be very important and will lead to a signal or not.
    Therefor i want to plot an alert message on the chart..something like
    "Crossover alert! If curent bar closing price will be greater/below value x.xx the moving average will cross and a position will be initiated at the openning price of the next bar."
    Basically i want to know before the bar close if the curent price of the bar will be enough to generate a crossover when the bar will be closed.
    Is this possible?
    Thank you.
    Last edited by 1800promote; 02-19-2009, 11:02 PM.

    #2
    Originally posted by 1800promote View Post
    Hello,

    I have a simple strategy based on 2 simple moving average crossover
    Let say we are 1 bar before a possible crossover. Since the moving averages are based on the closing price..the closing price of this bar will be very important and will lead to a signal or not.
    Therefor i want to plot an alert message on the chart..something like
    "Crossover alert! If curent bar closing price will be greater/below value x.xx the moving average will cross and a position will be initiated at the openning price of the next bar."
    Basically i want to know before the bar close if the curent price of the bar will be enough to generate a crossover when the bar will be closed.
    Is this possible?
    Thank you.
    It's possible with additional calculations in the script.

    Comment


      #3
      well...any guidance on how to do it?..or is too complicated to try to do it myself..

      Comment


        #4
        Originally posted by 1800promote View Post
        well...any guidance on how to do it?..or is too complicated to try to do it myself..
        OK. Let's use two SMA's SMA10 and SMA20.
        The approach would be like this:

        CalculateOnBarClose = false;

        if(SMA(10)[0] < SMA(20)[0] && Rising(SMA(10)))
        {
        double x = Close[0];

        while((SUM(Close, 9)[1] + x)/10 <= (SUM(Close, 19)[1] + x)/20)
        {
        x+=TickSize;
        }

        if (x - Close[0] <= 2*TickSize)
        {
        Print ("Hey, we are less than two ticks away from possible crossover");
        Print (" Be Prepared to Enter Long Position");
        }
        }

        Viceversa for oposite direction.

        I just give you an idea. I did not compile this code, I am writing it directly to the forum out of my head.

        If you want to use EMA or HMA or whatever MA you should use the appropriate calculation formulas.

        Hope it helps.

        roonius

        Comment


          #5
          thank you.will try it.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by fredrikn, 05-08-2019, 04:01 AM
          57 responses
          4,391 views
          2 likes
          Last Post Momentum  
          Started by Blairski, Yesterday, 09:19 AM
          2 responses
          11 views
          0 likes
          Last Post Blairski  
          Started by tonynt, Today, 09:33 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by minotti1, Today, 08:31 AM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_Jim  
          Started by SmartArtsStudio, 05-15-2021, 10:46 AM
          1 response
          15 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X