Currentbid & current ask in backtesting  [SOLVED]

Questions about MultiCharts and user contributed studies.
paulc
Posts: 59
Joined: 26 Sep 2012
Has thanked: 13 times
Been thanked: 2 times

Currentbid & current ask in backtesting

Postby paulc » 01 Dec 2012

Hi all,

My strategy uses bar magnifier and IOG set to off. I have added ask & bid data into the chart for data2 & data3 for extended backtesting.

When i use :

Buy ( "MomLE" ) next bar at open ;

and backtest i can see that the order is filled on the open of the next bar. Happy days.

When i use:

Buy ( "MomLE" ) next bar at 0.5 * (CURRENTASK + CURRENTBID) LIMIT ;

It's not so clear what price i am going to get filled at. I cannot find 'currentbid' and currentask' in the wiki.

What i am trying to do is put a limit order in at midway between the open bid-offer of the open on the next bar. Does this achieve it?

So if the opening bid-ask was 60/62 then i would have a limit order for 61. Does there need to be a trade placed at 61 or below for my buy to get filled in backtesting?

If i am not filled at the open at 61 does the limit order keep cancelling and resubmitting to a new mid-limit order until a trade price is found at my limit price or lower?

When i look at my backested results and the bars i appear to get my buys filled at or near the low and sells filled at the high or near of the bar. Not always but very often. I cannot make sense of this.

If i do not have IOG on then i have assumed that the limit order generated from the strategy calculation on the previous bar close is still in effect; ie the engine does not cancel the order. Indeed the order is placed so it is not getting cancelled, just at a price i cannot understand. But perhaps the price does not get updated so the limit price generated just remains the same as opposed to being updated during the next bar. But then why does backtest engine assume that sells are filled at the high of the bar and buys at the low of the bar.

Actually......maybe current bid/ask just dont work in backtesting??!

Thanks.

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

Re: Currentbid & current ask in backtesting

Postby TJ » 01 Dec 2012

Hi all,
My strategy uses bar magnifier and IOG set to off. I have added ask & bid data into the chart for data2 & data3 for extended backtesting.
When i use :
Buy ( "MomLE" ) next bar at open ;
and backtest i can see that the order is filled on the open of the next bar. Happy days.
When i use:
Buy ( "MomLE" ) next bar at 0.5 * (CURRENTASK + CURRENTBID) LIMIT ;
It's not so clear what price i am going to get filled at. I cannot find 'currentbid' and currentask' in the wiki.
What i am trying to do is put a limit order in at midway between the open bid-offer of the open on the next bar. Does this achieve it?
So if the opening bid-ask was 60/62 then i would have a limit order for 61. Does there need to be a trade placed at 61 or below for my buy to get filled in backtesting?
If i am not filled at the open at 61 does the limit order keep cancelling and resubmitting to a new mid-limit order until a trade price is found at my limit price or lower?
When i look at my backested results and the bars i appear to get my buys filled at or near the low and sells filled at the high or near of the bar. Not always but very often. I cannot make sense of this.
If i do not have IOG on then i have assumed that the limit order generated from the strategy calculation on the previous bar close is still in effect; ie the engine does not cancel the order. Indeed the order is placed so it is not getting cancelled, just at a price i cannot understand. But perhaps the price does not get updated so the limit price generated just remains the same as opposed to being updated during the next bar. But then why does backtest engine assume that sells are filled at the high of the bar and buys at the low of the bar.
Actually......maybe current bid/ask just dont work in backtesting??!
Thanks.
Are you using Precise Backtesting?

Please start reading from here.
You will find 99% of the questions are already answered.
[FAQ] Autotrade / Backtest / Optimization
viewtopic.php?f=16&t=10811

paulc
Posts: 59
Joined: 26 Sep 2012
Has thanked: 13 times
Been thanked: 2 times

Re: Currentbid & current ask in backtesting

Postby paulc » 02 Dec 2012

Are you using Precise Backtesting?
Yes.
Please start reading from here.
You will find 99% of the questions are already answered.
[FAQ] Autotrade / Backtest / Optimization
viewtopic.php?f=16&t=10811
The page/topic you refer to doesnt mention currentbid/ask on the page. Do you know where i can find that?

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

Re: Currentbid & current ask in backtesting

Postby TJ » 02 Dec 2012

Are you using Precise Backtesting?
Yes.
Please start reading from here.
You will find 99% of the questions are already answered.
[FAQ] Autotrade / Backtest / Optimization
viewtopic.php?f=16&t=10811
The page/topic you refer to doesnt mention currentbid/ask on the page. Do you know where i can find that?
Have you saved the bid and ask data in your computer?
You can check it in the QuoteManager.

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

Re: Currentbid & current ask in backtesting

Postby TJ » 02 Dec 2012

Hi all,

My strategy uses bar magnifier and IOG set to off. I have added ask & bid data into the chart for data2 & data3 for extended backtesting.

When i use :

Buy ( "MomLE" ) next bar at open ;

and backtest i can see that the order is filled on the open of the next bar. Happy days.

When i use:

Buy ( "MomLE" ) next bar at 0.5 * (CURRENTASK + CURRENTBID) LIMIT ;

It's not so clear what price i am going to get filled at. I cannot find 'currentbid' and currentask' in the wiki.
...Thanks.
Please check the wiki for Quote Field keywords:

https://www.multicharts.com/trading-sof ... /Main_Page

down the middle of the page, look under:
PowerLanguage Keyword Reference > [+] Quote Fields‎ (27)

paulc
Posts: 59
Joined: 26 Sep 2012
Has thanked: 13 times
Been thanked: 2 times

Re: Currentbid & current ask in backtesting

Postby paulc » 02 Dec 2012

TJ,

That led me to this page:
https://www.multicharts.com/trading-sof ... ote_Fields

but currentbid/ask are not on there. i searched the wiki first thinking thats where id find the answer but they dont appear in search results.

do you know whether you can use currentbid/ask in backtesting?

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

Re: Currentbid & current ask in backtesting  [SOLVED]

Postby TJ » 02 Dec 2012

TJ,

That led me to this page:
https://www.multicharts.com/trading-sof ... ote_Fields
but currentbid/ask are not on there. i searched the wiki first thinking thats where id find the answer but they dont appear in search results.
do you know whether you can use currentbid/ask in backtesting?
There is no such a keyword as currentbid or currentask.
There are InsideBid and InsideAsk.

When you use extended backtesting, you do not need data2 or data3,
MultiCharts will fill the order using the bid and ask automatically.
But you must first have the bid ask data in the computer.

You can check to see if you have such data:
QuoteManager > Edit > Fields to Collect


Return to “MultiCharts”