Insidebid and Insideask

Questions about MultiCharts and user contributed studies.
LA901
Posts: 18
Joined: 15 Dec 2014
Has thanked: 7 times
Been thanked: 4 times

Insidebid and Insideask

Postby LA901 » 17 Jan 2015

I've had a search within the forum and I couldn't see a definitive answer to this:

Within live automated trading, if I reference Insidebid within an initial calculation, (with IntrabarOrderGeneration = true) for example:

Code: Select all

myBid = Insidebid ;
SwingHighValue = SwingHigh( 1,high,2,50); //most recent swing high over last 50 bars

If myBid > SwingHighValue then
SwingTest = true ;
Then if I have some more calculations and right before entry I want to check that the current bid price is within a certain max slippage range above the swing high e.g. only enter if current bid is not more than SlippagePips > SwingHighValue

Code: Select all

If myBid < SwingHighValue + SlippagePips then
SlippageTest = true ;
Then finally enter a trade:

Code: Select all

If SwingTest = true and SlippageTest = true then
Buy ( "Long" ) 100 contracts next bar market ;
Will each time I reference myBid (and thus InsideBid) automatically call the latest value for best bid price? Or will it always reference the same value i.e. the intial value it obtained first time myBid was referenced (and thus making using the slippage test right before entry redundant)?

Coming from an MQL4 background where in order to obtain the latest bid/ask price you would use RefreshRates() each time and if you didn't the bid and asked stayed the same as when last called regardless of what they currently are. Wasn't sure how InsideBid and InsideAsk worked in this regard.

Many thanks.

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

Re: Insidebid and Insideask

Postby TJ » 17 Jan 2015

InsideBid and InsideAsk are updated with each new tick.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Insidebid and Insideask

Postby JoshM » 17 Jan 2015

InsideBid and InsideAsk are updated with each new tick.
True, but as I understand this topic he's asking whether InsideBid and InsideAsk reflect values of when the current calculation started with the new tick or if these can also change while the current tick is being processed.

In MT, you can do the latter with `RefreshRates()` prior to referencing the prices in the code. We can't do that in MultiCharts, but it's not clear to me whether InsideBid reflects the inside bid when the calculation started or the value when it's referenced in the code (anew).

It's a great question. :]

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

Re: Insidebid and Insideask

Postby TJ » 17 Jan 2015

InsideBid and InsideAsk are updated with each new tick.
True, but as I understand this topic he's asking whether InsideBid and InsideAsk reflect values of when the current calculation started with the new tick or if these can also change while the current tick is being processed.

In MT, you can do the latter with `RefreshRates()` prior to referencing the prices in the code. We can't do that in MultiCharts, but it's not clear to me whether InsideBid reflects the inside bid when the calculation started or the value when it's referenced in the code (anew).

It's a great question. :]
InsideBid and InsideAsk are updated with each new tick.

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1544 times
Been thanked: 1565 times
Contact:

Re: Insidebid and Insideask

Postby JoshM » 17 Jan 2015

InsideBid and InsideAsk are updated with each new tick.
Without a source I wouldn't be comfortable making such a statement. Bid/ask prices are asynchronously updated in the Status Line (compared to real-time ticks) also, after all.

LA901
Posts: 18
Joined: 15 Dec 2014
Has thanked: 7 times
Been thanked: 4 times

Re: Insidebid and Insideask

Postby LA901 » 17 Jan 2015

Thanks for the prompt responses folks.

So, if I understand correctly if the bid price changes within the same tick it is not possible to obtain the updated bid price. Once you call insidebid for the 1st time that is the bid price that will be used throughout the calculations.

This does match what I've seen, I've never seen the reported bid price change within my signal at different points - although of course it does actually change within the same tick.

Therefore this renders my slippage test, or any kind of slippage test redundant because you cannot assess whether the bid price has changed since first referenced. Of course this opens up the possibility of increased slippage in fast moving markets unless using limit orders (in actual fact the slippage I've seen i.e. difference between bid price used in calculations to that used for entry is more material that I would expect and thus the above explains why).

As referenced, in MT you could use refreshrates() to update the bid price and thus check the price right before entry to make sure it hadn't moved too far away from the bid price used for calculations.

Is there a way to achieve this in MC, or is the only option to use insidebid and have the one value per tick?

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

Re: Insidebid and Insideask

Postby TJ » 17 Jan 2015

Thanks for the prompt responses folks.

So, if I understand correctly if the bid price changes within the same tick it is not possible to obtain the updated bid price. Once you call insidebid for the 1st time that is the bid price that will be used throughout the calculations.

This does match what I've seen, I've never seen the reported bid price change within my signal at different points - although of course it does actually change within the same tick.

Therefore this renders my slippage test, or any kind of slippage test redundant because you cannot assess whether the bid price has changed since first referenced. Of course this opens up the possibility of increased slippage in fast moving markets unless using limit orders (in actual fact the slippage I've seen i.e. difference between bid price used in calculations to that used for entry is more material that I would expect and thus the above explains why).

As referenced, in MT you could use refreshrates() to update the bid price and thus check the price right before entry to make sure it hadn't moved too far away from the bid price used for calculations.

Is there a way to achieve this in MC, or is the only option to use insidebid and have the one value per tick?
YOu can use RecalcLastBarAfter.

LA901
Posts: 18
Joined: 15 Dec 2014
Has thanked: 7 times
Been thanked: 4 times

Re: Insidebid and Insideask

Postby LA901 » 17 Jan 2015

Thanks for the prompt responses folks.

So, if I understand correctly if the bid price changes within the same tick it is not possible to obtain the updated bid price. Once you call insidebid for the 1st time that is the bid price that will be used throughout the calculations.

This does match what I've seen, I've never seen the reported bid price change within my signal at different points - although of course it does actually change within the same tick.

Therefore this renders my slippage test, or any kind of slippage test redundant because you cannot assess whether the bid price has changed since first referenced. Of course this opens up the possibility of increased slippage in fast moving markets unless using limit orders (in actual fact the slippage I've seen i.e. difference between bid price used in calculations to that used for entry is more material that I would expect and thus the above explains why).

As referenced, in MT you could use refreshrates() to update the bid price and thus check the price right before entry to make sure it hadn't moved too far away from the bid price used for calculations.

Is there a way to achieve this in MC, or is the only option to use insidebid and have the one value per tick?
YOu can use RecalcLastBarAfter.
Thanks, I will look into this.


Return to “MultiCharts”