Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 23:44:09 +0000



Trading Days To Skip

View Count: 208

[2023-06-27 21:30:24]
User551752 - Posts: 25
// This program let you select the day to skip live trading or back testing.


#include "sierrachart.h"
SCDLLName("TradingDayToSkip")



SCSFExport scsf_EntryPoint(SCStudyInterfaceRef sc)

{

// Inputs



SCSubgraphRef Subgraph_TradingDayOnOff = sc.Subgraph[0];


SCInputRef TheYear = sc.Input[0];

SCInputRef FirstSkipMonth = sc.Input[1];
SCInputRef FirstSkipDay = sc.Input[2];

SCInputRef SecondSkipMonth = sc.Input[3];
SCInputRef SecondSkipDay = sc.Input[4];

SCInputRef ThirdSkipMonth = sc.Input[5];
SCInputRef ThirdSkipDay = sc.Input[6];

SCInputRef FourthSkipMonth = sc.Input[7];
SCInputRef FourthSkipDay = sc.Input[8];

SCInputRef FifthSkipMonth = sc.Input[9];
SCInputRef FifthSkipDay = sc.Input[10];

    
    

if (sc.SetDefaults) {


sc.GraphName = "TradingDayToSkip";

sc.AutoLoop = 1; //Automatic looping is enabled.




    Subgraph_TradingDayOnOff.Name = "Trading Day On/Off";
    Subgraph_TradingDayOnOff.DrawStyle = DRAWSTYLE_IGNORE;
    //Subgraph_TradingDayOnOff.PrimaryColor = RGB(255, 0, 0);
    //Subgraph_TradingDayOnOff.LineWidth = 1;
    //Subgraph_TradingDayOnOff.DrawZeros = false;
    
    
    sc.GraphRegion = 1;
    
    sc.AutoLoop = 1;

    TheYear.Name="Year";
    TheYear.SetInt(2023);
    

    FirstSkipMonth.Name="First Skip Day, Month";
    FirstSkipMonth.SetInt(0);

FirstSkipDay.Name="First Skip Day, Day";
    FirstSkipDay.SetInt(0);

    SecondSkipMonth.Name="Second Skip Day, Month";
    SecondSkipMonth.SetInt(0);

SecondSkipDay.Name="Second Skip Day, Day";
    SecondSkipDay.SetInt(0);

    ThirdSkipMonth.Name="Third Skip Day, Month";
    ThirdSkipMonth.SetInt(0);

    ThirdSkipDay.Name="Third Skip Day, Day";
    ThirdSkipDay.SetInt(0);

    FourthSkipMonth.Name="Fourth Skip Day, Month";
    FourthSkipMonth.SetInt(0);

    FourthSkipDay.Name="Fourth Skip Day, Day";
    FourthSkipDay.SetInt(0);

   FifthSkipMonth.Name="Fifth Skip Day, Month";
    FifthSkipMonth.SetInt(0);

    FifthSkipDay.Name="Fifth Skip Day, Day";
    FifthSkipDay.SetInt(0);

    


return;

}




  int Year = sc.BaseDateTimeIn[sc.Index].GetYear();
  int Month = sc.BaseDateTimeIn[sc.Index].GetMonth();
  int Day = sc.BaseDateTimeIn[sc.Index].GetDay();
  

if ( Year == TheYear.GetInt() ) {
  

if( (Month == FirstSkipMonth.GetInt() && Day == FirstSkipDay.GetInt()) || (Month == SecondSkipMonth.GetInt() && Day == SecondSkipDay.GetInt()) || (Month == ThirdSkipMonth.GetInt() && Day == ThirdSkipDay.GetInt()) || (Month == FourthSkipMonth.GetInt() && Day == FourthSkipDay.GetInt()) || (Month == FifthSkipMonth.GetInt() && Day == FifthSkipDay.GetInt())) {

  Subgraph_TradingDayOnOff[sc.Index] = 0 ;
}

else {

Subgraph_TradingDayOnOff[sc.Index] = 1;
}

}

}
Date Time Of Last Edit: 2023-06-28 06:22:50

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account