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

Re: EL Question on Print statement



PureBytes Links

Trading Reference Links

Looks as if you are using this on a tick-based chart and you have
several ticks with the same time in minutes. The LastBarOnChart
function is pretty stupid and just looks for the time of the last
bar. If you have several bars with the same time stamp, it is true
for all those bars.

You can use the following code to only print on the first such bar:

    Vars: LBInit(TRUE);

    if LastBarOnChart and LBInit then begin
       <print statement>
       LBInit = FALSE;
    end;

This works OK if the values you are printing do not change on the
other bars with the same time stamp.

If you REALLY need to do something only on the real last bar, I have
never found a way to do that.  Maybe someone else has.

Also note that the LastBarOnChart function does not seem to work if
you refer to the open on the next bar anywhere in your code. It seems
to be waiting for the bar after the last bar on the chart - really
clever...

Bob Fulks


At 9:58 PM -0400 8/12/01, Dave Nadeau wrote:

>When I add the following code to a Signal that I'm using in a strategy
>
>
>If LastBarOnChart then begin
>	Print(newline + GetSymbolName + ", "+ NumToStr(NetProfit,2)+"
>Profit"+" " + NumToSTr(PercentProfit,1)+" %,
>"+NumToStr(MaxIDDrawDown,2)+" MaxDD"+" " + NumToStr(Barnumber,0)+"
>Bars, "+NumToStr(TotalTrades,0)+" Trades");
>
>End;
>
>
>{The print statement is all on one line in the Power Editor}
>
>I will get six lines in my Debug window:
>
>
>ES M1, 18243.90 Profit 84.8 %, -569.70 MaxDD 84250 Bars, 2324 Trades
>
>ES M1, 18243.90 Profit 84.8 %, -569.70 MaxDD 84251 Bars, 2324 Trades
>
>ES M1, 18243.90 Profit 84.8 %, -569.70 MaxDD 84252 Bars, 2324 Trades
>
>ES M1, 18243.90 Profit 84.8 %, -569.70 MaxDD 84253 Bars, 2324 Trades
>
>ES M1, 18243.90 Profit 84.8 %, -569.70 MaxDD 84254 Bars, 2324 Trades
>
>ES M1, 18243.90 Profit 84.8 %, -569.70 MaxDD 84255 Bars, 2324 Trades
>
>ES M1, 18243.90 Profit 84.8 %, -569.70 MaxDD 84256 Bars, 2324 Trades
>
>
>instead of just one.
>
>Does anyone have any suggestions on what I'm doing wrong?
>
>Thanks!
>
>================
>Dave Nadeau
>Fort Collins, CO