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

BuySellPressure fails to read

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

    BuySellPressure fails to read

    Hi,

    I have a strategy running in which I want to use Buy and Sell Pressure.

    However, the strategy fails to read it. It always indicates 50/50 whereas I see
    on the chart the percentages are not 50/50

    This is the code:
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    BuySellPressure().CalculateOnBarClose = false;
    }

    protected override void OnBarUpdate()
    {

    if (Historical)
    return;

    //debug
    Print(Instrument.FullName.ToString() + " " + Time[0].ToString() + " BUYP " + BuySellPressure().SellPressure[0].ToString() + " SELLP " + BuySellPressure().BuyPressure[0].ToString()
    + " PREV BUYP " + BuySellPressure().SellPressure[1].ToString() + " PREV SELLP " + BuySellPressure().BuyPressure[0].ToString());

    }

    This is the output: (everytime 50/50)
    ES 12-15 10/12/2015 7:15:38 AM BUYP 50 SELLP 50 PREV BUYP 50 PREV SELLP 50
    CL 11-15 10/12/2015 7:15:58 AM BUYP 50 SELLP 50 PREV BUYP 50 PREV SELLP 50
    ES 12-15 10/12/2015 7:16:16 AM BUYP 50 SELLP 50 PREV BUYP 50 PREV SELLP 50
    M6A 12-15 10/12/2015 7:16:18 AM BUYP 50 SELLP 50 PREV BUYP 50 PREV SELLP 50
    ES 12-15 10/12/2015 7:16:28 AM BUYP 50 SELLP 50 PREV BUYP 50 PREV SELLP 50

    Does anyone have an idea what I'm doing wrong ?

    #2
    Update: I put the code BuySellPressure().CalculateOnBarClose = false;
    in OnBarUpdate() iso Initialize() (like the NT7 programming guide suggest), and that seems to work

    Comment


      #3
      Hello,

      Thank you for the reply.

      I wanted to check, you said this is resolved by placing BuySellPressure().CalculateOnBarClose = false; in the Initialize but see this was in your original example.

      I just wanted to verify was this resolved by using this as you have?

      If not please let me know and we can continue to look into the code.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Yes it is resolved now.

        Putting "BuySellPressure().CalculateOnBarClose = false" in Initialize() does not work.

        But "BuySellPressure().CalculateOnBarClose = false" in OnBarUpdate() does work.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by GwFutures1988, Today, 02:48 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by ScottWalsh, 04-16-2024, 04:29 PM
        6 responses
        32 views
        0 likes
        Last Post ScottWalsh  
        Started by frankthearm, Today, 09:08 AM
        10 responses
        36 views
        0 likes
        Last Post frankthearm  
        Started by mmenigma, Today, 02:22 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by NRITV, Today, 01:15 PM
        2 responses
        10 views
        0 likes
        Last Post NRITV
        by NRITV
         
        Working...
        X