[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Text To Charts V101 #42



PureBytes Links

Trading Reference Links

Bill wrote:

> Is it possible when using the text tool to lock the text so that it
> is always at the right side of the chart?
>
> Thanks.
>
> Bill

---------------------------
Here's an indicator I use when day trading the Emini Nasdaq (NQ) using
TS2000i.  It took me a long time to figure it all out, so I know what
you're going through.  *I* don't even know how it does what it does but
it seems to work.  But I thought it included alot of good examples of
stuff you need to be aware of when writing indicators with "text".  You
can probably use the ideas and adapt them to whatever you're doing.  I'm
sure there are better ways to do this and I'm open for suggestions. :-)

On a tick bar chart, enter your entry price (you have the option to use
a decimal point, but it's not required), how many contracts you are
short(-) or long(+), your profit target, initial risk.  The risk range
is the price where the trailing risk starts to move.  I.e.: if you are
long from 2500 with the default settings as shown, if the price moves
down you will just get out with a 10 point loss.  If the price moves up,
when it is within 2 points of your target the stop will move from 2490
to 2495. then when the price moves to 2510 the stop moves to break
even.  (In case your limit order is not hit.)  Just play with it in real
time, you'll catch on.

You'll also notice that I have two plots (they are small points using
the background color).  This is to keep the text visible, otherwise it
might be off the screen most of the time.

You'll notice that when the stop moves the old stop does not disappear
right away.  The next step would be to erase it.  It's kinda a work in
progress that I never really cared enough to finish since I only use it
as a guide.  I take alot of 1, 2 and 3 lot trades and it seems to help
me when I'm sleepy at 6:30am when the market opens and I'm using LeoWeb
and I can't remember if I'm buying or selling....

Take care,
Bob Perry
San Jose, CA

{	Bob Perry 1/01	}


Inputs:	Entry(250000),
		BScontracts(+1),
		Prft (10.00),
		Risk (10.00),
		RiskRange(2),
		TrailRisk(5.00)  ; 	
Vars:	EntryPoint(0), Flag(True), Trigger(0),
		ProfitVAL(c), ProfitREF(-1), ProfitTXT(""),
		RiskVAL(c), RiskREF(-1), RiskTXT(""),
		EntryVAL(c), EntryREF(-1), EntryTXT("") ;

If Date = CurrentDate AND time >= LastCalcTime then begin
	
If Entry > 5000 then begin
	EntryPoint = .01 * Entry;
End else EntryPoint = Entry;

{----  set variables and conditions  ----}
If BScontracts >0 then Begin
	EntryVAL = EntryPoint;
	ProfitVAL = EntryPoint+Prft;
	If Trigger = 0 then RiskVal = EntryPoint - Risk; 
	If Trigger = 0 and High >= ProfitVAL - RiskRange then trigger = 1 ;
	If (Trigger = 1 or Trigger = 2) then RiskVal = EntryPoint - Risk +
TrailRisk;
	If (Trigger = 1 or Trigger = 2) and (High >= ProfitVAL) then Trigger =
3 ;
	If (Trigger = 3 or Trigger = 4) then RiskVal = EntryPoint ;
	ProfitTXT = "SELL  " ;
	RiskTXT = "SELL  " ;
	If C >= ProfitVAL then Condition1 = True else Condition1 = False;
End;

If BScontracts <0 then Begin
	EntryVAL = EntryPoint;
	ProfitVAL = EntryPoint-Prft;
	If Trigger = 0 then RiskVal = EntryPoint + Risk;
	If Trigger = 0 and Low <= ProfitVAL + RiskRange then trigger = 1 ;
	If (Trigger = 1 or Trigger = 2) then RiskVal = EntryPoint + Risk -
TrailRisk;
	If (Trigger = 1 or Trigger = 2) and (Low <= ProfitVAL) then Trigger = 3
;
	If (Trigger = 3 or Trigger = 4) then RiskVal = EntryPoint ;
	ProfitTXT = "BUY  " ;
	RiskTXT = "BUY  " ;
	If C <= ProfitVAL then Condition2 = True else Condition2 = False;
End;

{----  write text to screen  ----}
If Trigger < 3 then begin
	If EntryREF <> -1 Then Text_SetLocation(EntryREF, Date, Time,
EntryVAL)		{Entry = Text#0}
		Else Begin
		EntryREF = Text_New(Date, Time, EntryVAL, NumToStr(100*EntryVAL, 0)+" 
EntryPoint---");
		Text_SetStyle(EntryREF, 1, 2);
		Text_SetColor(EntryREF, White) ;
	End;
End;
If Trigger = 3 then Text_Delete(EntryREF);

If Prft <> 0.00 then begin		{Profit = Text#1}
	If ProfitREF <> -1 Then
	Text_SetLocation(ProfitREF, Date, Time, ProfitVAL)
	Else Begin
		ProfitREF = Text_New(Date, Time, ProfitVAL, ProfitTXT + 
			NumToStr(AbsValue(BScontracts),0) + " @  " + NumToStr(100*ProfitVAL,
0)+"  Limit---");
		Text_SetStyle(ProfitREF, 1, 2);
		Text_SetColor(ProfitREF, Green) ;
	End;
End;

If Risk <> 0.00 then begin
	
	If RiskREF = -1 and Trigger = 0 then begin		{Risk = Text#2}
		RiskREF = Text_New(Date, Time, RiskVAL, RiskTXT + 
			NumToStr(AbsValue(BScontracts),0) + " @  " + NumToStr(100*RiskVAL,
0)+"  Market---");
		Text_SetStyle(RiskREF, 1, 2);
		Text_SetColor(RiskREF, Red) ;
	End;

	If Trigger = 1 then begin
		Trigger = 2 ;							{Text#3}
		RiskREF = Text_New(Date, Time, RiskVAL, RiskTXT + 
			NumToStr(AbsValue(BScontracts),0) + " @  " + NumToStr(100*RiskVAL,
0)+"  Market---");
		Text_SetStyle(RiskREF, 1, 2);
		Text_SetColor(RiskREF, Red) ;
	End;

	If Trigger = 3 then begin
		Trigger = 4 ;
		Text_Delete(RiskREF);
		RiskREF = Text_New(Date, Time, RiskVAL, RiskTXT + 
			NumToStr(AbsValue(BScontracts),0) + " @  " + NumToStr(100*RiskVAL,
0)+"  Market---");
		Text_SetStyle(RiskREF, 1, 2);
		Text_SetColor(RiskREF, Red) ;
	End;
	If RiskREF <> -1 Then Text_SetLocation(RiskREF, Date, Time, RiskVAL) ;

End;

Plot1(MaxList(ProfitVal+1,RiskVal+1),"upr");
Plot2(MinList(ProfitVal-1,RiskVal-1),"lwr");

{----  Alert  ----}
If Flag and CheckAlert and ( Condition1 or Condition2) then begin
	Alert = TRUE ;
	Flag = False;
End;

End;

Attachment: Description: "BP SHOWEXITTXT.ELA"