As I put in my post, there is nothing that I can find in the old out dated manuals or help files, hence the reason I ask on the board.
I beleive the answer to the question that I have asked is not in a manual but more of a multi line coding requirement.
I think you're right, at least I couldn't find anything about a 'trailing entry stop'-order in the manuals.
In a
related thread you asked..
Using the Intrabarordergeneration, it allows you to get into a trade a minute into a five bar but the creation of the orders for the exits (MC Setprofittarget or setbreakeven or setstoploss etc etc), do not appear until the 5min bar has completed. So any price movement in the next 4min could kill you.
However, on pdf page 92 from the EasyLanguage Essentials manual regarding IntraBarOrderGeneration:
Creating an intra-bar order strategy is exactly the same as a close of bar strategy;
it’s only the calculation procedure which is different. (...)
When intra-bar order generation turned on, next bar really means next tick.
So, when you submit a stop loss order "next bar" it does get executed on the same bar (if necessary) with IOG on.
Also, for the SetStopLoss commands and it's brothers:
EasyLanguage includes built-in exit commands that may be included directly in your strategies. These special commands will be active even on the bar of entry; that is, they are evaluated on each tick (regardless of any setting for Intrabar Order Generation on the Calculation tab of the Format Strategy dialog).
(p. 100, same manual)
That being said, that won't give yet an 'trailing entry stop'-position entry. However, such logic can be coded with with the IOG turned on. Because each tick gets evaluated with IOG on, you can submit a conditional market order which would act as a stop.
PS: I'm quite doubtful if the part below is correct, because wouldn't be an 'entry trailing stop' the same as a regular conditional market order? Hmm. The more I think about it, the more confused I get.
Anyway, let's say you want to enter when the Fast MA is below the Slow MA (short condition), and the price reaches a new low (trailing entry condition):
Won't the following code (with 'one entry per bar' setting) be in effect an 'entry trailing stop'?
Code: Select all
[IntraBarOrderGeneration = TRUE]
Variables:
maFast(0), maSlow(0), lowestPrice(0), shortCondition(False);
// Short conditions, evaluated on the end of the bar
if (BarStatus(1) = 2) then begin
maFast = Average(Close, 9);
maSlow = Average(Close, 18);
if (maFast < maSlow) then
shortCondition = True
else
shortCondition = False;
if (MarketPosition(0) = -1) and (BarsSinceEntry(0) = 10) then
BuyToCover ("XS#1") all contracts next bar at market;
end;
lowestPrice = Lowest(Low, 30)[1]; // this would be the trailing part
// Submit a market order if the current tick is lower then
// the low of the previous 30 bars
if (shortCondition = True) and (Close < lowestPrice) then
SellShort ("ES#1") 1000 contracts next bar at market;
Which would give: