Page 1 of 1

Place text at order entry/exit bar

Posted: Aug 06 2013
by ivanyu
Hi,

I am new to EasyLanguage, I have some logic that determines when to long (as below), and would like to also place the entry price at that bar (since order label cannot be dynamic).

However, the text is placed on every bar after the condition is true, which makes me really puzzled

Order is not entered multiple times though.

Is that because my max position is 1?

Or somehow because Text_New is a series function?

Sorry if this sounds very primitive.

Thanks!



if Close crosses over UpperBand then
Buy ( "SVE Vol LE" ) next bar market ;
Value2 = Text_New(Date, Time, Low, NumToStr(EntryPrice, 0));

Re: Place text at order entry/exit bar

Posted: Aug 06 2013
by TJ
...because your text instruction was for every bar.

you should code it this way:

Code: Select all

var:
my.entry(-1);

if Close crosses over UpperBand then
BEGIN
Buy ( "SVE Vol LE" ) next bar market ;
my.entry = Text_New(Date, Time, Low, NumToStr(EntryPrice, 0));
END;


ps:
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

Re: Place text at order entry/exit bar

Posted: Aug 06 2013
by ivanyu
I did have begin-end block as per your suggestion, my mistake in the original posting.

It is still printing entry price multiple times, maybe it is because the strategy has max 1 position, and that's why the cross over condition is actually satisfied multiple times, but still only 1 entry always?

Another point is, this logic says buy at next bar, so would it know the entry price at this bar?

Re: Place text at order entry/exit bar

Posted: Aug 07 2013
by furytrader
You could always qualify your condition as follows:

Code: Select all

var:
my.entry(-1);

if Close crosses over UpperBand AND MarketPosition < 1 then
BEGIN
Buy ( "SVE Vol LE" ) next bar market ;
my.entry = Text_New(Date, Time, Low, NumToStr(EntryPrice, 0));
END;
In this way, it would only place the text when you place your order to buy, and no time while it is open.

Re: Place text at order entry/exit bar

Posted: Aug 08 2013
by Andrew MultiCharts
Another point is, this logic says buy at next bar, so would it know the entry price at this bar?
EntryPrice will be available only at next calculation (next close by default) after entry order is filled and entry price is returned by your broker to MC.