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

Multi TimeFrame Strategy

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

    Multi TimeFrame Strategy

    Hi,

    I'm trying to develop a multi time frame strategy. The following is the entire of the strategy. I backtested it on strategy analyzer. I left all the parameters to default. Only changed the following
    from: 12/4/2011
    To: 12/9/2011
    Session Template: Forex
    Min. Bars Required: 0

    protected override void Initialize()
    {
    CalculateOnBarClose =
    false;
    Add(
    "$EURUSD", PeriodType.Day, 1);
    Add(
    "$EURUSD", PeriodType.Tick, 1);
    AddPointAndFigure(
    "$EURUSD", PeriodType.Tick, 1, 5, 3, PointAndFigurePriceType.HighsAndLows, MarketDataType.Last);

    }

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)
    {

    Print(
    "Today's Date is " + ToDay(Time[0]) + " " + "Current Bar Index is " + CurrentBar);
    Print(
    "");
    }

    }
    I got the following result on the output window
    Today's Date is 20111206 Current Bar Index is 1
    Today's Date is 20111207 Current Bar Index is 2
    Today's Date is 20111208 Current Bar Index is 3
    Today's Date is 20111209 Current Bar Index is 4
    My question is that, why is the first bar [0] for 12/5//2011 isn't printed?

    #2
    30percent, this would be unfortunately an expected limitation when a daily series is added programmatically eventhough your BarsRequired is at 0 it would print for CurrentBar = 1 and higher then.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks.

      Also, how can I get bid price referencing the tick object without using BarsInProgress?
      I don't think I could do this - GetCurrentBid[2]

      Comment


        #4
        You're welcome, that should work though - what behavior do you see? Please keep in mind this would only work for realtime / market replay, since for historical data the close price will be substituted.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        22 views
        0 likes
        Last Post trilliantrader  
        Started by Davidtowleii, Today, 12:15 AM
        0 responses
        3 views
        0 likes
        Last Post Davidtowleii  
        Started by guillembm, Yesterday, 11:25 AM
        2 responses
        9 views
        0 likes
        Last Post guillembm  
        Started by junkone, 04-21-2024, 07:17 AM
        9 responses
        70 views
        0 likes
        Last Post jeronymite  
        Started by mgco4you, Yesterday, 09:46 PM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X