Hello,
I've read https://www.multicharts.com/trading-sof ... Calculated and i'm using now [IntrabarOrderGeneration=true]
So that the profit target and stoploss of X point will be executed intrabar.
Altough, the entrysignal (long/short) should be End Of Bar.
Is that possible?
MultiCharts64 Version 9.0 Release (Build 11210)
Entry EOB Target/Stop intrabar [SOLVED]
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Entry EOB Target/Stop intrabar
Without your codes, if it difficult to give a definitive answer.Hello,
I've read https://www.multicharts.com/trading-sof ... Calculated and i'm using now [IntrabarOrderGeneration=true]
So that the profit target and stoploss of X point will be executed intrabar.
Altough, the entrysignal (long/short) should be End Of Bar.
Is that possible?
MultiCharts64 Version 9.0 Release (Build 11210)
When you are using [IntrabarOrderGeneration=true],
and you want entrysignal to execute EOB,
you have to add BARSTATUS=2.
eg.
Code: Select all
if barstatus=2 then
begin
// your entrysignal <<--- ENTRY, you asked for EOB ENTRY only
end;
// put your intrabar signals here <<--- put your intrabar signals here OUTSIDE of the barstatus=2
Re: Entry EOB Target/Stop intrabar
I implemented it and it indeed seems that the entry is EOB altough the [IntrabarOrderGeneration=true] is used. Which is good.
But now also the profit and the stoploss are end of bar.
In the code I used the barstatus where I should expect it counts only for entries (LE, SE) and stops (LongSL, ShortSL) to use EOB. Not for profittargets (LX, SX), those should be intrabar..
Something not correct?
But now also the profit and the stoploss are end of bar.
In the code I used the barstatus where I should expect it counts only for entries (LE, SE) and stops (LongSL, ShortSL) to use EOB. Not for profittargets (LX, SX), those should be intrabar..
Something not correct?
Code: Select all
if MarketPosition =0 then begin
if (barstatus=2 and le) and not lx and not se then begin
buy ("Long ") next bar open;
end;
if (barstatus=2 and se) and sx = false and le = false then begin
sellshort ("Short ") next bar open;
end;
end
else if MarketPosition = 1 then begin
if lx or (barstatus=2 and Longsl) then begin
if se then begin
sellshort ("Short") next bar open;
end;
end;
if lx then begin
sell ("LongExit") next bar open;
end;
if barstatus=2 and Longsl then begin
sell ("LongSL") next bar open;
end;
end
else if MarketPosition = -1 then begin
if sx or (barstatus=2 and Shortsl) then begin
if le then begin
buy ("Long") next bar open;
end;
end;
if sx then begin
buytocover ("ShortExit") next bar open;
end;
if (barstatus=2 and Shortsl) then begin
buytocover ("ShortSL") next bar open;
end;
end;
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Entry EOB Target/Stop intrabar
I don't see your [IntrabarOrderGeneration=true].I implemented it and it indeed seems that the entry is EOB altough the [IntrabarOrderGeneration=true] is used. Which is good.
But now also the profit and the stoploss are end of bar.
In the code I used the barstatus where I should expect it counts only for entries (LE, SE) and stops (LongSL, ShortSL) to use EOB. Not for profittargets (LX, SX), those should be intrabar..
Something not correct?
::
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Entry EOB Target/Stop intrabar
The devil is in the details.
Your snippet looks ok.
You just have to check every detail that is not in this snippet.
Your snippet looks ok.
You just have to check every detail that is not in this snippet.
Re: Entry EOB Target/Stop intrabar
The [IntrabarOrderGeneration=true] was above.
Because it didn't worked as expected, i tried to use the statusbar in the definition of the LE, SE and the stops. But with no different outcome.
This is the full code.
Because it didn't worked as expected, i tried to use the statusbar in the definition of the LE, SE and the stops. But with no different outcome.
This is the full code.
Included the strategy propertiesInputs:
TargetL(11), TargetS(11), ExitL(50), ExitS(50), FixStop(20);
variables:
LE(false), LX(false), Longsl(false), SE(false), SX(false), Shortsl(false);
[IntrabarOrderGeneration=true]
LE = barstatus=2 and close > average(close,10) ;
LX = MarketPosition = 1 and barstatus=2 and c > (entryprice + TargetL) ;
Longsl = barstatus=2 and MarketPosition = 1 and Close < (EntryPrice - Exitl) ;
SE = barstatus=2 and close < average(close,10) and close < Average(close,15) ;
SX = MarketPosition = -1 and barstatus=2 and c < (entryprice - TargetS) ;
Shortsl = barstatus=2 and MarketPosition = -1 and Close > (EntryPrice + ExitS) or c > Average(close,20) ;
setexitonclose;
if MarketPosition =0 then begin
if le and not lx and not se then begin
buy ("Long ") next bar open;
end;
if se and sx = false and le = false then begin
sellshort ("Short ") next bar open;
end;
end
else if MarketPosition = 1 then begin
if lx or Longsl then begin
if se then begin
sellshort ("Short") next bar open;
end;
end;
if lx then begin
sell ("LongExit") next bar open;
end;
if Longsl then begin
sell ("LongSL") next bar open;
end;
end
else if MarketPosition = -1 then begin
if sx or Shortsl then begin
if le then begin
buy ("Long") next bar open;
end;
end;
if sx then begin
buytocover ("ShortExit") next bar open;
end;
if Shortsl then begin
buytocover ("ShortSL") next bar open;
end;
end;
- Attachments
-
- strategy_prop.JPG
- StrategyProp
- (60.72 KiB) Downloaded 755 times
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Entry EOB Target/Stop intrabar
Have you looked up the meaning and application of BARSTATUS ?The [IntrabarOrderGeneration=true] was above.
Because it didn't worked as expected, i tried to use the statusbar in the definition of the LE, SE and the stops. But with no different outcome.
The link to Wiki is at the top of the page under the Support tab.
Re: Entry EOB Target/Stop intrabar
Had a search on forum but not in wiki. (stupid me )
I try to understand the concept of barstatus and I think this will do the trick but in practice I don't see always direct impact on the signals.
Can I combine it like here?
Or should I use it in the if then else condition concering the marketposition?
Like here:
I try to understand the concept of barstatus and I think this will do the trick but in practice I don't see always direct impact on the signals.
Can I combine it like here?
Code: Select all
LE = barstatus=2 and close > average(close,10) ;
LX = MarketPosition = 1 and barstatus=2 and c > (entryprice + TargetL) ;
Longsl = barstatus=1 and MarketPosition = 1 and Close < (EntryPrice - Exitl) ;
SE = barstatus=2 and close < average(close,10) and close < Average(close,15) ;
SX = MarketPosition = -1 and barstatus=2 and c < (entryprice - TargetS) ;
Shortsl = barstatus=2 and MarketPosition = -1 and Close > (EntryPrice + ExitS) or c > Average(close,20) ;
Like here:
Code: Select all
else if MarketPosition = 1 then begin
if lx or (Longsl and barstatus=1) then begin
if se then begin
sellshort ("Short") next bar open;
end;
end;
if lx then begin
sell ("LongExit") next bar open;
end;
if Longsl and barstatus=1 then begin
sell ("LongSL") next bar open;
end;
end
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Entry EOB Target/Stop intrabar [SOLVED]
Please go back to the Wiki and read the definition of Barstatus again.Had a search on forum but not in wiki. (stupid me )
I try to understand the concept of barstatus and I think this will do the trick but in practice I don't see always direct impact on the signals.
Can I combine it like here?
::
Please go back to post #2 and read my answer again.
I have edited it and highlighted the important points.
"Barstatus=2" is not a magic bullet;
applying it blindly or indiscriminately will not get the precision result you want.