intrabarordergeneration

Questions about MultiCharts and user contributed studies.
Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

intrabarordergeneration

Postby Dug » 04 Sep 2009

Hello, I am a little confused by the result kicked out here after i have downloaded the latest version 5.5 and was wondering about interbar order generation. The chart has more notes on it as an explanation.
I have also attached the code as well.
- why do the orders get executed at the high when the command is for them to be executed at the next bar on open.
- and yet the exits are executed on the next bar at close when they are triggered.

Basically the aim was to enter on the next bar on the open after an entry trigger, and then to execute AS SOON as the exit is triggered. This will be when the low goes lower than a certain point.
thanks for any help.
......................

Code: Select all

[IntrabarOrderGeneration = True];
vars: LStop(0);

{CHECK STOPS}

if low<LStop then begin
sell("lx") this bar;
LStop=0;
end;


{ENTRIES}
condition1 = close[1]<close[5] and close>close[4];
if condition1 then
begin
buy("le") next bar on open;
LStop=low;
end ;

{trailstops}

LStop=maxlist(LStop,lowest(low,5));
messagelog(date,LStop, lowest(low,5));
Attachments
picture2.png
(40.68 KiB) Downloaded 1000 times

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Re: intrabarordergeneration

Postby SUPER » 06 Sep 2009

Hello, I am a little confused by the result kicked out here after i have downloaded the latest version 5.5 and was wondering about interbar order generation. The chart has more notes on it as an explanation.
I have also attached the code as well.
- why do the orders get executed at the high when the command is for them to be executed at the next bar on open.
- and yet the exits are executed on the next bar at close when they are triggered.

Basically the aim was to enter on the next bar on the open after an entry trigger, and then to execute AS SOON as the exit is triggered. This will be when the low goes lower than a certain point.
thanks for any help.
......................

[IntrabarOrderGeneration = True];
vars: LStop(0);

{CHECK STOPS}

if low<LStop then begin
sell("lx") this bar;
LStop=0;
end;


{ENTRIES}
condition1 = close[1]<close[5] and close>close[4];
if condition1 then
begin
buy("le") next bar on open;
LStop=low;
end ;

{trailstops}

LStop=maxlist(LStop,lowest(low,5));
messagelog(date,LStop, lowest(low,5));
Dug,

I have added barstatus in your code and it may achive what you are looking for on your entry bar.

Code: Select all

{ENTRIES}
condition1 = close[1]<close[5] and close>close[4];
if barstatus(1)=2 and condition1 then
begin
buy("le") next bar on open;
LStop=low;
end ;

Regards
Super

Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 07 Sep 2009

thankyou.
Yes it does on the entry bar, it resets and allows it to trade on the open.

Now how do i get it to exit once the exit is triggered and not just on the close?

SUPER
Posts: 646
Joined: 03 Mar 2007
Has thanked: 106 times
Been thanked: 84 times

Postby SUPER » 08 Sep 2009

thankyou.
Yes it does on the entry bar, it resets and allows it to trade on the open.

Now how do i get it to exit once the exit is triggered and not just on the close?
for exit i would try something like:

Code: Select all

{Exit}

if MarketPosition=1 and low<LStop then begin
sell("lx") next bar at market;
LStop=0;
end;

{trailstops}

LStop=maxlist(LStop,lowest(low,5)[1]);

Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 08 Sep 2009

Hi super, I appreciate the help (I need it when it comes to programming)
But unfortunuately this just reversed the situation :cry:
Now the exits all seems to occur on the low of the day.

I was wondering if MC had an ability to measure/alert if the stop was triggered.
ie; so when backtesting you had the ability to say, "as soon as its triggered" then you can exit a position.....and not just on the close, and or open, or on some preset values.

So far no one from MC themselves has been much help, with this or another issue i have regarding allocating correctly exits, as opposed to exiting everything in one hit... hint hint.

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

Postby TJ » 08 Sep 2009

Hi super, I appreciate the help (I need it when it comes to programming)
But unfortunuately this just reversed the situation :cry:
Now the exits all seems to occur on the low of the day.

I was wondering if MC had an ability to measure/alert if the stop was triggered.
ie; so when backtesting you had the ability to say, "as soon as its triggered" then you can exit a position.....and not just on the close, and or open, or on some pr
eset values.

So far no one from MC themselves has been much help, with this or another issue i have regarding allocating correctly exits, as opposed to exiting everything in one hit... hint hint.

I don't think PROGRAMMING your strategy is MC's responsibility.


May I suggest:

Building Winning Trading Systems with TS
http://www.amazon.com/Building-Winning- ... 0471215694

Image

.
Last edited by TJ on 12 Jan 2010, edited 1 time in total.

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

Postby TJ » 08 Sep 2009

p.s. markplex has very good EasyLanguage tutorials.

http://www.markplex.com/

Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 08 Sep 2009

I am not asking for them to program. I am asking them why certain things that are meant to work in a certain manner dont.... the signal is very simple. I would just like something that works.
Supposedly you can name and exit specific entries.
eg; buy 1, buy 2, buy 3, exit 2, then exit 3, then buy 2, exit 1.
Well based on the information i have recieved and found in forums this does not appear to be so, and there has been no response from MC, only other helpful forum people. including yourself.
I trialed for 30 days and prior to this being up, i subscribed as i was told, if you want extra help then you should subscribe......yet then this response.
I understand people are busy etc, but the reality is a lot of the criticisms for charting/testing packages revolves around providers not providing good backup help, manuals etc.
MC has the best potential I have seen to be really good..... but potential means nothing if the reality does not live up to expectations.

Also thanks for the other hints and tips..... I have actually learnt most of what I know from your very helpful postings.

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

Postby TJ » 08 Sep 2009

[edited]

IOG, when enabled, simply means that
when your signal is triggered,
the order will be sent the NEXT TICK.
(instead of waiting until the next bar)

There is really nothing complicated about IOG; having understood that, you just have to work your logic, line-by-line, step-by-step, around this functionality.

Scaling in/out is advanced level programming, this is not something you can master in 30 days, nor the first try. The difficulty is not in understanding the meaning of the keywords, but in designing the completeness of your logic -- i.e. to ensure that every permutation, at every juncture, is covered.

The easiest way to visualize the integrity and completeness of your logic is to draw up a flow chart, and then match your code line-by-line with the logic flow.

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

Postby TJ » 08 Sep 2009

p.s.

backtesting do not replicate real life trading.

the difference being,
in real life, trades are streamed to you tick by tick,
while in backtest, the trades are presented to you in a monolithic block.
i.e. on the chart, each bar has 4 data points -- OHLC. The only intrabar data being H and L.

Therefore, in backtesting with IOG, the buy will be filled at H, while the sell will be filled at L.

Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 09 Sep 2009

Thanks TJ.
I understand all this. We built a very detailed backtester with a lot of flexibility in excel. It tests 40 instruments over 15 years of data. The problem is it takes 45 mins to run a test, and a lot of maintenance of the data, hence i am trying to go to a system that packages the data, and also gives me enough flexibility to be able to accurately depict the real world. (i have been trading (profitably) for 15 yrs so i have a good understanding of this aspect of it.) While certain systems offer backtesting (its not portfolio level), others offer charting but crap testing. MC might offer what we need.
So my logic is fine, its a matter of ensuring I learn the logic of Easy Language, but more importantly, rather than me chasing my tail for things that cannot be done here (yet) and getting frustrated i am trying to work out with some simple code etc; what is actually happening with the code and the system....perfect example is realising the drawdown info in the performance reports is flawed. hence why rely on it, and why bang your head trying to find errors in it.

You actually answered my question a bit.... if intrabar order generation exits on the high and low for the bar.... and NOT when they are actually triggered then MC cannot do what I require. While OHLC are great, in reality unless you are very small in volume, these levels are a little meaningless, except as triggers. You need to use something like vwap, or a typical price weighted between the 4 prices. OR you exit when the trigger occurs and give yourself a legitimate measure of measuring slippage.
I guess alternatively I find and pay someone to program it.... but that from experience can open a whole other can of worms....
Anyway I thankyou for your help....and I figure I will just keep plodding along asking questions.

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

Postby TJ » 13 Sep 2009

[updated]


for backtesting, you can invoke precision by adding a finer data series

Go to Format Signals> Progperties...

Image


(p.s. this works the same as Look inside Bar Backtesting LIBB in TS)
Attachments
Backtesting_Precision.gif
Backtesting Precision
Look Inside Bar Backtesting
(17.87 KiB) Downloaded 991 times

User avatar
Henrik
Posts: 140
Joined: 13 Apr 2010
Has thanked: 25 times
Been thanked: 11 times

Postby Henrik » 12 May 2010

Dear Developer Team,
please add the Bar Magnifier to Portfolio Backtester.
Thank you!

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Postby Dave Masalov » 18 May 2010

Dear Developer Team,
please add the Bar Magnifier to Portfolio Backtester.
Thank you!
We will definitely add this feature in the future. However it will make sence only when MultiCharts will switch to 64 bit. Otherwise it will consume too much resources.


Return to “MultiCharts”