#include "sierrachart.h"
enum PricecaseEnum
{
PC_UNKNOWN = -0xBAD,
PC_XB = 1, // Translation Black -$$$$-
PC_XR = 2, // Translation Red -$$$$-
// Outside bars
PC_OUTB = 3,
PC_OUTR = 4,
PC_OUT_DOJI = 5,
// Lateral Formations ALWAYS begin with
// one of the following PriceCases...
PC_HITCH = 10,
PC_FTP = 11, // Flat Top Pennant
PC_FBP = 12, // Flat Bottom Pennant
PC_SYM = 13, // Symmetrical Pennant
PC_STB = 14, // Stitch Black
PC_STR = 15, // Stitch Red
};
PricecaseEnum GetPriceCase(SCBaseDataRef InData, long index)
{
// Determine Pricecase of 2 adjacent price bars (index & index-1)
// Lateral formations are NOT determined here as only
// a ***possibility of the start*** of a lateral formation can
// be determined using 2 bars. (see PricecaseEnum)
// IsLateral and TrackLateral honor lateral user settings
// and lateral specific vars, and handles monitoring at least a minimum
// 3 bar lateral formation and ultimate end of lateral movement.
float H0 = InData[SC_HIGH][index];
float H1 = InData[SC_HIGH][index - 1];
float L0 = InData[SC_LOW][index];
float L1 = InData[SC_LOW][index - 1];
if (H0 > H1 && L0 > L1)
return PC_XB;
else if (H0 < H1 && L0 < L1)
return PC_XR;
else if (H0 == H1 && L0 == L1)
return PC_HITCH;
else if (H0 == H1 && L0 > L1)
return PC_FTP;
else if (H0 == H1 && L0 < L1)
return PC_STR;
else if (L0 == L1 && H0 < H1)
return PC_FBP;
else if (L0 == L1 && H0 > H1)
return PC_STB;
else if (L0 > L1 && H0 < H1)
return PC_SYM;
else if (L0 < L1 && H0 > H1)
// Outside Black or Red or
if (InData[SC_LAST][index] > InData[SC_OPEN][index])
return PC_OUTB;
else if (InData[SC_LAST][index] < InData[SC_OPEN][index])
return PC_OUTR;
else
return PC_OUT_DOJI;
else
return PC_UNKNOWN;
}