Login Page - Create Account

Support Board


Date/Time: Sat, 11 Jan 2025 06:17:37 +0000



Post From: Spreadsheet Trading CROSSOVER/ABOVE/BELOW Question

[2016-11-01 16:58:11]
Sierra Chart Engineering - Posts: 104368
You need to write your own custom formula. Here is the source code for the crossover function which will help:
  int CrossOver(SCFloatArrayRef First, SCFloatArrayRef Second, int Index)
  {
    float X1 = First[Index-1];
    float X2 = First[Index];
    float Y1 = Second[Index-1];
    float Y2 = Second[Index];

    if (X2 != Y2) // The following is not useful if X2 and Y2 are equal
    {
      // Find non-equal values for prior values
      int PriorIndex = Index - 1;
      while (X1 == Y1 && PriorIndex > 0 && PriorIndex > Index - 100)
      {
        --PriorIndex;
        X1 = First[PriorIndex];
        Y1 = Second[PriorIndex];
      }
    }

    if (X1 > Y1 && X2 < Y2)
      return CROSS_FROM_TOP;
    else if (X1 < Y1 && X2 > Y2)
      return CROSS_FROM_BOTTOM;
    else
      return NO_CROSS;
  }

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing