Login Page - Create Account

Support Board


Date/Time: Wed, 15 Jan 2025 23:48:06 +0000



Post From: Unable to calculate or draw sc.Lowest()

[2017-09-15 20:30:56]
User203925 - Posts: 40
The following code draws sc.Highest but it will not draw nor calculate sc.Lowest. Any thoughts why it will not work with sc.Lowest?




SCSFExport scsf_DOUBLE_TOP_BOTTOM_TRADE_MGMT_V2(SCStudyInterfaceRef sc)
{
SCSubgraphRef HighestHigh = sc.Subgraph[0];
SCSubgraphRef LowestLow = sc.Subgraph[1];

SCSubgraphRef LoB = sc.Subgraph[16];
SCSubgraphRef HiB = sc.Subgraph[17];

SCInputRef Length = sc.Input[3];

if (sc.SetDefaults)
{
sc.GraphName = "Double Top / Bottom Reversal Trade Mgmt V2";

sc.GraphRegion = 0;
sc.AutoLoop = true;
sc.FreeDLL = 1;
sc.AllowMultipleEntriesInSameDirection = false;
sc.AllowOnlyOneTradePerBar = false;
sc.MaintainTradeStatisticsAndTradesData = true;
sc.AlertOnlyOncePerBar = true;
sc.SupportReversals = true;
//sc.MaximumPositionAllowed = 5;
//sc.AllowOppositeEntryWithOpposingPositionOrOrders = false;
//sc.CancelAllOrdersOnEntriesAndReversals = true;
sc.AllowEntryWithWorkingOrders = true;
//sc.CancelAllWorkingOrdersOnExit = true;

HiB.Name = "Highest High";
    HiB.DrawStyle = DRAWSTYLE_LINE;
    HiB.PrimaryColor = COLOR_GRAY;
    HiB.DrawZeros = false;
    //HiB.GraphicalDisplacement = 1;

    LoB.Name = "Lowest Low";
    LoB.DrawStyle = DRAWSTYLE_LINE;
    LoB.PrimaryColor = COLOR_GRAY;
    LoB.DrawZeros = false;
    //LoB.GraphicalDisplacement = 1;

Length.Name = "Length ";
    Length.SetInt(100);
    Length.SetIntLimits(1, MAX_STUDY_LENGTH);

return;
  }

if (sc.BaseData[SC_HIGH][sc.Index - 3] <= sc.BaseData[SC_HIGH][sc.Index - 2] && sc.BaseData[SC_HIGH][sc.Index - 2] > sc.BaseData[SC_HIGH][sc.Index - 1]) {
    
    HighestHigh[sc.Index] = sc.BaseData[SC_HIGH][sc.Index-2] ;
    sc.Highest(HighestHigh, HiB, Length.GetInt());
  }
  

if (sc.BaseData[SC_LOW][sc.Index - 3] >= sc.BaseData[SC_LOW][sc.Index - 2] && sc.BaseData[SC_LOW][sc.Index - 2] < sc.BaseData[SC_LOW][sc.Index - 1]) {
      // Valley Found
    LowestLow[sc.Index] = sc.BaseData[SC_LOW][sc.Index - 2];
    sc.Lowest(LowestLow, LoB, Length.GetInt());
  }


}