Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with FisherTransformation "If" Condition

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

    Help with FisherTransformation "If" Condition

    Hello,

    I am new to Ninja scripting and running into a problem checking the FisherTransform value using an "if" condition. I am check if if is above or below zero and then doing a different action. But when running my code, it does seems like it pays any attention to my check condition and just process the on bar close all the time. Attached is a screen shot of my code and a sample output screen. Any help would be appreciated.



    Thanks,
    Don

    #2
    Hello Don,

    Thank you for your post.

    When you run the script, what do you set CalculateOnBarClose to?

    The screenshot and sample output screen are not attached
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Script and sample output provided

      Below is the scrpti I wrote. Note I am checking FisherTransform [0] to [1], If it is greater, it is to do a calculation and then print. If is not, then skip. However, my script seems like it executes and by-passes the conditional test. Don't see what is wrong. Please help.

      Thanks,

      Script

      protectedoverridevoid OnBarUpdate()
      {
      // Condition set 1

      {

      if (FisherTransform(10)[0] >= FisherTransform(10)[1] );
      {
      Print (
      "Here you are Fisher " + FisherTransform(10)[0]);
      double dif_amt = FisherTransform(10)[0]-FisherTransform(10)[1];
      Print (Time[
      0]+ "Fisher reading Above 0 "+ FisherTransform(10)[0]+ " "+ FisherTransform(10)[1]);
      Print (
      "Here you are Fisher difference = " + dif_amt );
      Print (
      "" );}

      //DrawTriangleUp("My triangle up" + CurrentBar, false, 0, 0, Color.Lime);}

      }
      }

      output

      Here you are Fisher -0.276987079459044
      1/29/2014 3:40:00 PMFisher reading Above 0 -0.276987079459044 -0.477982914865078
      Here you are Fisher difference = 0.200995835406034
      Here you are Fisher -0.0886339295180742
      1/29/2014 3:42:00 PMFisher reading Above 0 -0.0886339295180742 -0.276987079459044
      Here you are Fisher difference = 0.18835314994097
      Here you are Fisher 0.336455687551804
      1/29/2014 3:44:00 PMFisher reading Above 0 0.336455687551804 -0.0886339295180742
      Here you are Fisher difference = 0.425089617069878

      Comment


        #4
        /// This method is used to configure the strategy and is called once before any strategy method is called.
        ///</summary>
        protectedoverridevoid Initialize()
        {
        SetProfitTarget(
        "", CalculationMode.Percent, 3);
        CalculateOnBarClose =
        true;
        }
        ///<summary>
        /// Called on each bar update event (incoming tick)
        ///</summary>
        protectedoverridevoid OnBarUpdate()

        Comment


          #5
          Code:
          [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (FisherTransform([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]10[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]] >= FisherTransform([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]10[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]] )[SIZE=4][B][COLOR=Red];[/COLOR][/B][/SIZE][/SIZE][/FONT][/SIZE][/FONT]
          That statement is a null statement because it is terminated by a semi-colon. Remove the semi-colon.

          Comment


            #6
            That's it! It's working now.

            Thanks!
            Don

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            559 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            324 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            546 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X