Hi Guys,
I've written some code for finding flat bar which is FlatBar = high == low and signal me when 2 adjacent flatbar difference is 0.01. However, it's a bit of an hit and miss situation... Here is the code... Looking for idea to improve... Thanks
I've written some code for finding flat bar which is FlatBar = high == low and signal me when 2 adjacent flatbar difference is 0.01. However, it's a bit of an hit and miss situation... Here is the code... Looking for idea to improve... Thanks
Code:
# This is to find Flat bar of current and previous bar that is difference by 0.01
Declare Lower;
Input Decimal = 2;
Input Diff = 0.01;
Def FlatBar = high == low;
Def FlatBarValue = GetValue(low, FlatBar, 0);
def FlatBarDiff = Round(absValue(FlatBarValue - FlatBarValue[1]),Decimal) == Diff;
Plot FBD = FlatBarDiff;
FBD.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
FBD.SetDefaultColor(GetColor(2));
FBD.SetLineWeight(2);