Place text at order entry/exit bar

Questions about MultiCharts and user contributed studies.
ivanyu
Posts: 31
Joined: 24 Jul 2013
Has thanked: 3 times
Been thanked: 1 time

Place text at order entry/exit bar

Postby ivanyu » 06 Aug 2013

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));

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Place text at order entry/exit bar

Postby TJ » 06 Aug 2013

...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

ivanyu
Posts: 31
Joined: 24 Jul 2013
Has thanked: 3 times
Been thanked: 1 time

Re: Place text at order entry/exit bar

Postby ivanyu » 06 Aug 2013

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?

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Place text at order entry/exit bar

Postby furytrader » 07 Aug 2013

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.

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Place text at order entry/exit bar

Postby Andrew MultiCharts » 08 Aug 2013

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.


Return to “MultiCharts”