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

PriorDay for Gaps

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

    PriorDay for Gaps

    I've been reading and researching the site about this but I'm having a hard time since I'm not a real programmer.

    From what I understand, I need to first run this code to see what day it is:

    {
    /* If the day is Monday, and we want the value from Friday, we must subtract 3 days from the current date.
    If the day is Tuesday-Friday, just subtract one day. */
    if (Time[0].DayOfWeek == DayOfWeek.Monday)
    timeOfInterest = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day - 3, 9, 30, 0);
    else
    timeOfInterest = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day - 1, 9, 30, 0);
    }

    Now I just want it run go short if the open is greater than previous close:


    if (ToTime(Time[0]) == ToTime(9, 30, 0)
    && (ShowClose && ToDay(DateTime.Today) == ToDay(Time[0].Date)) PriorClose.Set(priordayClose);
    && Open[0] > PriorDayOHLC().PriorClose[1])
    {
    EnterShort(DefaultQuantity, "");
    }

    This doesn't seem to work as there are a lot of errors. Am I going down the right path? I just want to trade off a gap, I can figure out all of the other details but I can't get the model to pull up the right data.

    Thanks

    #2
    Hello,

    Thanks for your note.

    What kind of errors?

    I look forward to assisting you further.

    Comment


      #3
      i've attached a screen pic
      Attached Files

      Comment


        #4
        Hello,

        Yes your missing a bunch of needed code to make this code compile.

        Unfortunately this is more general programming type stuff then NinjaScript support.

        However if you post your full code on the forums here I can give it a quick debug to find the missing things you need.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by judysamnt7, 03-13-2023, 09:11 AM
        4 responses
        59 views
        0 likes
        Last Post DynamicTest  
        Started by ScottWalsh, Today, 06:52 PM
        4 responses
        36 views
        0 likes
        Last Post ScottWalsh  
        Started by olisav57, Today, 07:39 PM
        0 responses
        7 views
        0 likes
        Last Post olisav57  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        21 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        10 views
        0 likes
        Last Post cre8able  
        Working...
        X