If one of the AFL experts out there could help me out, it would be greatly
appreciated. I do not understand why, in this formula the sell price is not
being executed according to my stops. Please understand this is a
work-in-progress and not meant to be a complete formula. I put in all the
columns to try and trace the calculations. I'm sure it is a simple answer, but
I seem to be missing it.
ATRx = Optimize("ATR Multiplier", 3, 1, 5, 1); // ATR Multiplier
WATR = ((Ref(ATR(8),-2)*8) + (ATR(1)*1.125) + (Ref(ATR(1)*1.125,-1)))/10;
//Weighted ATR (last 20% has a 12.5% weighting factor)
twentydayupper = Ref(HHV(H, 20), -1);
Sellstop = BuyPrice - WATR*2;
SellPrice = BuyPrice + WATR*ATRx;
Buy = Cross(C, twentydayupper);
Sell = Cross(Sellstop, C) OR Cross(C, SellPrice);
AddColumn(ATRx, "ATRx");
AddColumn(ATR(10), "ATR");
AddColumn(WATR, "Weighted ATR");
AddColumn(Ref(ATR(8),-2), "ATR(8) Two Days Ago");
AddColumn(ATR(1)*1.125, "Weighted ATR Today");
AddColumn(Ref(ATR(1)*1.125,-1), "Weighted ATR Yesterday");
AddColumn(twentydayupper, "20 Day Upper");
AddColumn(Sellstop, "Sellstop");
AddColumn(SellPrice, "SellPrice");
AddColumn(BuyPrice, "BuyPrice");
AddColumn(C, "Close");
Filter=1;
Any help is appreciated