sorry for my english!
I'm trying to create me some good visual indicators and I got a good point, but now I can not improve it.
I want to simply create a horizontal line and a text when RSI indicator is croses under 30 and crosses over 70. then I want that when there is a new signal I need to delete the old lines and txt.
The problem that generates me is that I can not make clear the old signals and the horizontal lines disappear after a while and I have to turn off the indicator and turn it back on.
what is wrong? thanks
this is my code list: (and attach my Dow Jones 15 minutes chart!)
Code: Select all
inputs:
Price (Close),
RSILength( 14 ),
OverSold( 30 ),
OverBought( 70 ),
HighTLColor (red),
LowTLColor (darkgreen),
TLSize(1),
TLStyle(1),
HighTextColor (red),
LowTextColor (darkgreen),
TextSize(14);
Variables:
MyRSI( 0 ),
VertTxtP1 (0), // 0 - Plot UP, 1 - Plott Down, 2 - Plot Center
HorizTxtP1 (0), // 0 - Plotta Right , 1- Plot Left, 2- Plotta Center
OldRSIHigh (0),
OldRSILow (0),
OldTXTLow (0),
OldTXTHigh (0),
HiTxt (-1),
LoTxt (-1),
HiTL (-1),
LoTL (-1);
MyRSI = RSI( Price, RSILength ) ;
if MyRSI crosses under OverSold then
begin
OldRSILow = LoTL;
OldTXTLow = LoTxt;
LoTL = TL_New (Date[1], Time[1], Low, Date, Time, Low);
TL_SetColor(LoTL, LowTLColor);
TL_SetSize(LoTL,TLSize);
TL_SetStyle(LoTL,TLStyle);
LoTxt = Text_New(Date[1], Time[1], Low, " BUY ZONE ");
text_setcolor(LoTxt,LowTextColor);
text_setsize(LoTxt,TextSize);
Text_SetStyle(LoTxt,HorizTxtP1, VertTxtP1);
Value1 = TL_SetExtRight(LoTL, True);
if OldRSILow <> -1 then //reset Old line
Value1 = tl_delete (OldRSILow);
Value2 = tl_setextright(LoTxt, True);
if OldTXTLow <> -1 then
Value2 = tl_delete (OldTXTLow);
end;
if MyRSI crosses over OverBought then
begin
OldRSIHigh = HiTL;
OldTXTHigh = HiTxt;
HiTL = TL_New (Date[1], Time[1], High, Date, Time, High);
TL_SetColor(HiTL, HighTLColor);
TL_SetSize(HiTL,TLSize);
TL_SetStyle(HiTL,TLStyle);
HiTxt = Text_New(Date[1], Time[1], High, " SELL ZONE ");
text_setcolor(HiTxt,HighTextColor);
text_setsize(HiTxt,TextSize);
Text_SetStyle(HiTxt,HorizTxtP1, VertTxtP1);
Value3 = TL_SetExtRight(HiTL, True);
If OldRSIHigh <> -1 Then
Value3 = TL_Delete(OldRSIHigh);
Value4 = tl_setextright(HiTxt, True);
if OldTXTHigh <> -1 then
Value4 = tl_delete(OldTXTHigh);
End;