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));
Place text at order entry/exit bar
- TJ
- Posts: 7775
- Joined: Aug 29 2006
- Location: Global Citizen
- Has thanked: 1036 times
- Been thanked: 2233 times
...because your text instruction was for every bar.
you should code it this way:
ps:
[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713
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
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?
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?
- furytrader
- Posts: 354
- Joined: Jul 30 2010
- Location: Chicago, IL
- Has thanked: 155 times
- Been thanked: 217 times
You could always qualify your condition as follows:
In this way, it would only place the text when you place your order to buy, and no time while it is open.
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;
- Andrew MultiCharts
- Posts: 1587
- Joined: Oct 11 2011
- Has thanked: 931 times
- Been thanked: 559 times
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.Another point is, this logic says buy at next bar, so would it know the entry price at this bar?