Is it possible to have a Buy signal when the OBV crosses my Bottom line (Green Line) which stays in the same position. The Buy signals seem to only show up where the OBV is at number 0. enter image description here
TopLevel = 50000; // Static upper threshold
BottomLevel = -50000; // Static lower threshold
Top1 = 40000;
Bottom1 = -40000;
obvValue = OBV();
Buffer = 500; // A buffer for noise filtering (adjustable value)
Plot(TopLevel, "Top Static Line", colorRed, styleLine | styleNoLine | styleNoTitle);
Plot(BottomLevel, "Bottom Static Line", colorGreen, styleLine | styleNoLine | styleNoTitle);
Plot(obvValue, "OBV", colorBlue, styleLine | styleOwnScale | styleThick); // Plot OBV line for debugging
Plot(Top1, "Top Static Line", colorRed, styleLine | styleThick | styleNoTitle);
Plot(Bottom1, "Bottom Static Line", colorGreen, styleLine | styleThick | styleNoTitle);
BuySignal = Cross(obvValue, Bottom1 + Buffer) AND obvValue < Bottom1 - Buffer;
SellSignal = Cross(Top1 - Buffer, obvValue) AND obvValue > Top1 + Buffer;
Plot( IIf(BuySignal, obvValue, Null), "Buy Signal", colorGreen, styleHistogram | styleNoTitle );
Plot( IIf(SellSignal, obvValue, Null), "Sell Signal", colorRed, styleHistogram | styleNoTitle );
Plot(obvValue, "Debug OBV", colorYellow, styleLine | styleOwnScale | styleDashed);
Title = EncodeColor(colorWhite) + "OBV: " + WriteVal(obvValue, 1.2) +
" | TopLevel: " + WriteVal(TopLevel, 1.2) +
" | BottomLevel: " + WriteVal(BottomLevel, 1.2);
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745575502a4633937.html
评论列表(0条)