Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 12:16:47 +0000



Post From: Assistance with converting study alert code to acsil

[2022-09-05 14:29:09]
User907968 - Posts: 802
SCSFExport scsf_RenkoReversal(SCStudyInterfaceRef sc)
{
  auto& sg_RevBuy = sc.Subgraph[0];
  auto& sg_RevSell = sc.Subgraph[1];

  if (sc.SetDefaults)
  {
    sc.GraphName = "Renko Reversal";
    sc.GraphRegion = 0;
    sc.AutoLoop = 0;
    
    sg_RevBuy.Name = "Renko Buy Reversal";
    sg_RevBuy.DrawStyle = DRAWSTYLE_ARROW_UP;
    sg_RevBuy.LineWidth = 5;
    sg_RevBuy.PrimaryColor = COLOR_GREEN;

    sg_RevSell.Name = "Renko Sell Reversal";
    sg_RevSell.DrawStyle = DRAWSTYLE_ARROW_DOWN;
    sg_RevSell.LineWidth = 5;
    sg_RevSell.PrimaryColor = COLOR_RED;

    return;
  }

  for (auto index = sc.UpdateStartIndex; index < sc.ArraySize; ++index)
  {
    if (sc.GetBarHasClosedStatus(index) != BHCS_BAR_HAS_CLOSED)
      continue;

    if (sc.BaseDataIn[SC_RENKO_CLOSE][index] > sc.BaseDataIn[SC_RENKO_OPEN][index]
      && sc.BaseDataIn[SC_RENKO_CLOSE][index - 1] < sc.BaseDataIn[SC_RENKO_OPEN][index - 1])
    {
      sg_RevBuy[index] = sc.Low[index] - 5 * sc.TickSize;
      sg_RevSell[index] = 0.0f;
    }

    if (sc.BaseDataIn[SC_RENKO_CLOSE][index] < sc.BaseDataIn[SC_RENKO_OPEN][index]
      && sc.BaseDataIn[SC_RENKO_CLOSE][index - 1] > sc.BaseDataIn[SC_RENKO_OPEN][index - 1])
    {
      sg_RevSell[index] = sc.High[index] + 5 * sc.TickSize;
      sg_RevBuy[index] = 0.0f;
    }
  }
}

Try the above code.
Date Time Of Last Edit: 2022-09-05 14:30:57
imagerenko_reversal.png / V - Attached On 2022-09-05 14:28:26 UTC - Size: 61.76 KB - 85 views