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

Re: Random entries + LeBeau exit = Profitable system



PureBytes Links

Trading Reference Links

Here's an alternate way to make discretionary Buys and Sells show up in
TS.

Use the text tool to put, say, "H" and "L" above the bar you want to
buy/sell on. Then recalculate the indicator. 

Its as close as I can get to mouse-pointing a "buy here" or "sell here".
And its a little easier than changing Inputs. 

You shouldn't have any difficulty modifying this sample code to do
precisely what you want.

/Greg

{=================================================================}


{ SYSTEM: MyEntry }

{ 
USAGE

Use the text tool to select the bar and place, for this sample, any of
"H", "L", "long", "short" on the chart. The click "Status" twice in
Format Analysis Techniques to cause the indicator to recalculate.  This
way, the indicator can find the text you just entered.

You can put as many characters or strings on the chart as you wish. You
might even use "X" to force an exit.
}

var: handl(0), lab(""), gotLab(false);;

gotLab = false;
begin { examine all the text strings }
   handl = text_getfirst(2);
   while handl > 0 begin
      lab = text_getstring(handl); { save the item's date, time, value
and handle }
      if lab = "H" or lab = "L" or lab = "long" or lab = "short" or lab
= "X" then
         { is the label on this bar? }
         if  text_gettime(handl) = time then
            if text_getdate(handl) = date then begin
               gotLab = true;
            end;
      if gotLab then
         handl = 0 { exit the loop }
      else 
         handl = text_getnext(handl,2); { IMPORTANT -- infinite loop if
this is missing!  }
   end;
end;

if gotLab then begin { note that orders cannot be within loops }
   if lab = "H" then buy at h stop
   else if lab = "L" then sell at l stop
   else if lab = "short" then sell at market
   else if lab = "long" then buy at market
   else if lab = "X" then begin
      exitlong at market;
      exitshort at market;
   end;
end;