Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM in ninja script strategy

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

    #31
    This will not work as you constantly update your reference value then with the RSI being under the treshhold value - you want to record the value of it crossing below it...then you can check on the following bars if the new values are smaller or not and thus if a new lowest reference value need to be saved or not.

    Comment


      #32
      Then what should I do? Just a little/single of code of pseudocode as guide for this.

      Comment


        #33
        luxurious_04, unfortunately we could not code this out for you, however something along those lines would be needed -

        if (yourCondition) refValue = RSIValue;

        if (RSIValue < refValue)
        refValue = RSIValue

        else

        refValue = refValue[1];

        The will let you keep a reference to the lowest RSI value since your condition evaluated to 'true'.

        Comment


          #34
          Thanks Bertran I understand your side but this will be a great help for me. This refValue, do I need to declare this on the variable section as double?

          Comment


            #35
            Yes, that would for example be a double.

            Comment


              #36
              Thanks Bertran, I figured it out that It should be double.

              Comment


                #37
                if (RSI(RSIperiod, RSIsmooth).Avg[0] <= 20)
                {
                refValue = RSI(RSIperiod, RSIsmooth).Avg[0];
                Print("The Current RSI average is:" + refValue);
                Print("Time is:" + Time[0]);

                }
                if (refValue < RSI(RSIperiod, RSIsmooth).Avg[0])
                {
                refValue2 = RSI(RSIperiod, RSIsmooth).Avg[0];
                Print("lower" + refValue2);
                }
                else
                {
                refValue2= refValue;
                Print("The RSI is higher than the previous" + refValue2);
                Print("remain the value");
                }

                It's not working well, please help on this.

                Comment


                  #38
                  I replied already to your email sent to support directly - thanks.

                  Comment


                    #39
                    Hello Bertran, I just want to ask if my strategy is calculated tick by tick for example a 50 tick. Itwill only ran properly in a chart that is a 50 tick interval? Because I tried to test the strategy in a 10 minute chart and I set my strategy properties into a tick type and set to 50 then session template to default 24/7 and then my strategy is not working well. But when I change the properties to minute type and set it to 10 and my session template is used instrument setting. It does mean that if your strategy is tick by tick type then you will going to build a new chart that is a tick by tick and ran it in there?

                    Comment


                      #40
                      luxurious_04, I'm not sure I follow you - if your rules trigger conditions you would see trades on the tick or minute charts, there's per se no logic that would prevent a strategy not to run on a specific interval. If you're working with the ATM's please don't attempt to backtest them, they will only work in Market Replay or live testing.

                      Comment


                        #41
                        Atm Strategy add-on

                        Hello Bertran:

                        Bertran thanks for all your suggestions or ideas that you've share to me. Here me again need for your help in adding an add-on to the atm strategies. If I have an pending order that have not or already filled and there is another open entry signal I would like to take that as add on. Is there a way of that? If there is please give me a tip.

                        Comment


                          #42
                          Unfortunately you can't change the pending order qty, only the price thus you would need to cancel it and submit a new AtmStrategyCreate then.

                          Comment


                            #43
                            My atm strategy missed good signal entry because of the orderId and strategy is not yet empty. Any help for this? How about i will reset the two id's when the order is filled so that it will get the next signal entry? What will happen?

                            Comment


                              #44
                              Correct, you would need to take proper care to reset the strategy and order id as outlined in our 'SampleAtmStrategy' so you can take a fresh entry then.

                              Comment


                                #45
                                Time problem

                                Hello Bertran I have a time filter problem:

                                startTime = new DateTime(0001, 1, 1, 6, 30, 00); // ignore the date portion. It is unused
                                endTime = new DateTime(0001, 1, 1, 15, 20, 00);

                                if (ToTime(Time[0]) >=ToTime(startTime) && ToTime(Time[0]) <= ToTime(endTime))


                                In the market replay it will not start to trade at 6:30 am and end trade at 15:20. It works well in the market replay but in live it will not start to trade at 6:30 which is supposed to be to trade.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                                0 responses
                                649 views
                                0 likes
                                Last Post Geovanny Suaza  
                                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                                0 responses
                                370 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by Mindset, 02-09-2026, 11:44 AM
                                0 responses
                                109 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                                0 responses
                                573 views
                                1 like
                                Last Post Geovanny Suaza  
                                Started by RFrosty, 01-28-2026, 06:49 PM
                                0 responses
                                576 views
                                1 like
                                Last Post RFrosty
                                by RFrosty
                                 
                                Working...
                                X