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 DJ888, Today, 10:57 PM
        0 responses
        1 view
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        158 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Today, 09:29 PM
        0 responses
        7 views
        0 likes
        Last Post Belfortbucks  
        Started by zstheorist, Today, 07:52 PM
        0 responses
        7 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        151 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Working...
        X