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

Store Value and Compare

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

    Store Value and Compare

    In strategy builder, Attempting with a 2 different int default 0 to then calculate and define and store a value for each of the int variables, THEN COMPARE THE TWO TO EACH OTHER

    CRUDE EXAMPLE to store indicator values

    CONDITIONS AREA OF CODE

    SampleValue1 = MACD 6 bars ago onbarclose - MACD displaced 0 bars ago onbarclose

    SampleValue2 = MACD 20 bars ago onbarclose - MACD displaced 10 bars ago onbarclose

    SampleValue1 > SampleValue2

    ACTION

    PAINTBACKBRUSH = BLUE

    Can I actual store those Values in that manner
    Thanks

    #2
    Hello DTSSTS,

    Thanks for your post.

    The MACD indicators values are of a double type. You can create integer type variables and when you assign the MACD results to it, the variable will only hold the whole number value of the MACD (no values after the decimal point of the MACD) I suspect you really want these to be double values instead of Integer type.

    You would not be able to use displacement in the strategy builder.

    You can certainly subtract the MACD value 6 bars ago from the current bar of the MACD and can subtract the MACD 20 bars ago from the MACD of 10 bars ago.

    In order to populate your variables, I would suggest using a set that has no conditions and the only actions would be to assign the subtracted values to the variables. By using a set without conditions, these variables would be updated on each bar (or tick) depending on the strategy Calculate setting.

    The back brush can be found in the action section under Drawing>Set background color.



    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Wil a double hold the values of dollar figures ie price if the indicator i am plotting is plotting dollars and of course they have decimals

      thanks

      Comment


        #4
        Hello DTSSTS,

        Thanks for your reply.

        Yes, a double type variable can hold floating-point values within the range of -1.79769313486232E+308 to 1.79769313486232E+308

        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Max238, Today, 01:28 AM
        5 responses
        40 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by giulyko00, Yesterday, 12:03 PM
        3 responses
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by habeebft, Today, 07:27 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by AveryFlynn, Today, 04:57 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by r68cervera, Today, 05:29 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X