Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 mmenigma, Today, 02:22 PM
            0 responses
            2 views
            0 likes
            Last Post mmenigma  
            Started by frankthearm, Today, 09:08 AM
            9 responses
            35 views
            0 likes
            Last Post NinjaTrader_Clayton  
            Started by NRITV, Today, 01:15 PM
            2 responses
            9 views
            0 likes
            Last Post NRITV
            by NRITV
             
            Started by maybeimnotrader, Yesterday, 05:46 PM
            5 responses
            26 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by quantismo, Yesterday, 05:13 PM
            2 responses
            21 views
            0 likes
            Last Post quantismo  
            Working...
            X