Bid and Ask Volume from last Tick

Created at 31 May 2014, 00:08
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AN

Antonma

Joined 31.05.2014

Bid and Ask Volume from last Tick
31 May 2014, 00:08


Hi,

is it possible to get the Ask and Bid Volume of last Tick (Bid or Ask is changed)?

If I use 

double tickVolume = MarketSeries.TickVolume[index];

it shows me the tick count.

Thank you and best regards,

Anton

 


@Antonma
Replies

Spotware
02 Jun 2014, 11:24

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.


@Spotware

Antonma
02 Jun 2014, 11:49

RE:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

Ok, thank you for the clarification. What about the volume? How can I get the volume (not tick count) associated to the bid change?

Regards,

Anton


@Antonma

Spotware
03 Jun 2014, 09:19

RE: RE:

Antonma said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

Ok, thank you for the clarification. What about the volume? How can I get the volume (not tick count) associated to the bid change?

Regards,

Anton

There is no such functionality.


@Spotware

hiba7rain
21 Jul 2014, 00:24

RE:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

 

Hi Spotware, 

what could be wrong with the following , my intention to create  two different methods to close position one is via stop loss parameter and other by value of ask price against EMA

is it possible to do so? if yes how to?

private void Open(TradeType tradType)
        {

            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
            Print(LastResult.Position.TradeType);
        }


        private void Close()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);

            }

            if (ema1.Result.LastValue > Symbol.Ask)
            {
                Close();
            }

        } 

 


@hiba7rain

Spotware
21 Jul 2014, 10:08

RE: RE:

 

one is via stop loss parameter 

You set the stoploss on executing market order. So no extra actions needed there.

 ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);

 

other by value of ask price against EMA is it possible to do so? if yes how to?

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

                }
            }

        } 

 

other by value of ask price against EMA

is it possible to do so? if yes how to?

 

hiba7rain said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

 

Hi Spotware, 

what could be wrong with the following , my intention to create  two different methods to close position one is via stop loss parameter and other by value of ask price against EMA

is it possible to do so? if yes how to?

private void Open(TradeType tradType)
        {

            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
            Print(LastResult.Position.TradeType);
        }


        private void Close()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);

            }

            if (ema1.Result.LastValue > Symbol.Ask)
            {
                Close();
            }

        } 

 

 


@Spotware

hiba7rain
21 Jul 2014, 10:22

RE: RE: RE:

Thanks for your reply

ill change it as you advice me and keep you updated

is there any link or source might be useful to understand the codes and variables to be used if I would like to work on a robot using bars

 

Spotware said:

 

one is via stop loss parameter 

You set the stoploss on executing market order. So no extra actions needed there.

 ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);

 

other by value of ask price against EMA is it possible to do so? if yes how to?

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

                }
            }

        } 

 

other by value of ask price against EMA

is it possible to do so? if yes how to?

 

hiba7rain said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

 

Hi Spotware, 

what could be wrong with the following , my intention to create  two different methods to close position one is via stop loss parameter and other by value of ask price against EMA

is it possible to do so? if yes how to?

private void Open(TradeType tradType)
        {

            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
            Print(LastResult.Position.TradeType);
        }


        private void Close()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);

            }

            if (ema1.Result.LastValue > Symbol.Ask)
            {
                Close();
            }

        } 

 

 

 


@hiba7rain

hiba7rain
21 Jul 2014, 12:55

RE: RE: RE:

Thanks its working perfectly but with a major problem if I operate the robot it close all other opened positions with

if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

Any suggestions??

Regards,

Spotware said:

 

one is via stop loss parameter 

You set the stoploss on executing market order. So no extra actions needed there.

 ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);

 

other by value of ask price against EMA is it possible to do so? if yes how to?

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

                }
            }

        } 

 

other by value of ask price against EMA

is it possible to do so? if yes how to?

 

hiba7rain said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

 

Hi Spotware, 

what could be wrong with the following , my intention to create  two different methods to close position one is via stop loss parameter and other by value of ask price against EMA

is it possible to do so? if yes how to?

private void Open(TradeType tradType)
        {

            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
            Print(LastResult.Position.TradeType);
        }


        private void Close()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);

            }

            if (ema1.Result.LastValue > Symbol.Ask)
            {
                Close();
            }

        } 

 

 

 


@hiba7rain

Spotware
21 Jul 2014, 14:08

RE: RE: RE: RE:

is there any link or source might be useful to understand the codes and variables to be used if I would like to work on a robot using bars

OnBar - you can use it to execute you logic on each incoming Bar.

but with a major problem if I operate the robot it close all other opened positions with

It closes all positions because you iterate through all positions and call ClosePosition. It's up to you what positions should be closed.

 

hiba7rain said:

Thanks its working perfectly but with a major problem if I operate the robot it close all other opened positions with

if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

Any suggestions??

Regards,

Spotware said:

 

one is via stop loss parameter 

You set the stoploss on executing market order. So no extra actions needed there.

 ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);

 

other by value of ask price against EMA is it possible to do so? if yes how to?

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

                }
            }

        } 

 

other by value of ask price against EMA

is it possible to do so? if yes how to?

 

hiba7rain said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

 

Hi Spotware, 

what could be wrong with the following , my intention to create  two different methods to close position one is via stop loss parameter and other by value of ask price against EMA

is it possible to do so? if yes how to?

private void Open(TradeType tradType)
        {

            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
            Print(LastResult.Position.TradeType);
        }


        private void Close()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);

            }

            if (ema1.Result.LastValue > Symbol.Ask)
            {
                Close();
            }

        } 

 

 

 

 


@Spotware

hiba7rain
21 Jul 2014, 15:33

RE: RE: RE: RE: RE:

 Thanks but how to make it (close position) assigned to a specific  executed market order trade type , I have tried to do it using closepositions.Find but I think I done something wrong and its not working with me 

Spotware said:

is there any link or source might be useful to understand the codes and variables to be used if I would like to work on a robot using bars

OnBar - you can use it to execute you logic on each incoming Bar.

but with a major problem if I operate the robot it close all other opened positions with

It closes all positions because you iterate through all positions and call ClosePosition. It's up to you what positions should be closed.

 

hiba7rain said:

Thanks its working perfectly but with a major problem if I operate the robot it close all other opened positions with

if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

Any suggestions??

Regards,

Spotware said:

 

one is via stop loss parameter 

You set the stoploss on executing market order. So no extra actions needed there.

 ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);

 

other by value of ask price against EMA is it possible to do so? if yes how to?

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

                }
            }

        } 

 

other by value of ask price against EMA

is it possible to do so? if yes how to?

 

hiba7rain said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

 

Hi Spotware, 

what could be wrong with the following , my intention to create  two different methods to close position one is via stop loss parameter and other by value of ask price against EMA

is it possible to do so? if yes how to?

private void Open(TradeType tradType)
        {

            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
            Print(LastResult.Position.TradeType);
        }


        private void Close()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);

            }

            if (ema1.Result.LastValue > Symbol.Ask)
            {
                Close();
            }

        } 

 

 

 

 

 


@hiba7rain

Invalid
21 Jul 2014, 15:58

RE: RE: RE: RE: RE: RE:

Take a look at guide. ExecuteMarketOrder returns an object with Position inside.

Quick sample:

        private Position _position;

        protected override void OnStart()
        {
           //....initialize ema1
            _position = ExecuteMarketOrder(TradeType.Sell, Symbol, 20000).Position;
        }

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                _position=null;
            }
        }

 

hiba7rain said:

 Thanks but how to make it (close position) assigned to a specific  executed market order trade type , I have tried to do it using closepositions.Find but I think I done something wrong and its not working with me 


@Invalid

hiba7rain
21 Jul 2014, 18:19

RE: RE: RE: RE: RE: RE: RE:

Thank you but no its still not working , i applied it as follows

private Position _position;





        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                _position = null;
            }
        }

    }
}

if I start the robot for example with GBPUSD and i opened a trade with other pair of currency say like AUDUSD it will be closed as soon as ema>symbol.ask condition with AUDUSD

applies which is weird  

Invalid said:

Take a look at guide. ExecuteMarketOrder returns an object with Position inside.

Quick sample:

        private Position _position;

        protected override void OnStart()
        {
           //....initialize ema1
            _position = ExecuteMarketOrder(TradeType.Sell, Symbol, 20000).Position;
        }

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                _position=null;
            }
        }

 

hiba7rain said:

 Thanks but how to make it (close position) assigned to a specific  executed market order trade type , I have tried to do it using closepositions.Find but I think I done something wrong and its not working with me 

 


@hiba7rain

hiba7rain
21 Jul 2014, 21:45

RE: RE: RE: RE: RE:

am I doing something wrong in the following method as am still having the same problem all positions get closed as I run the Robot , positions that the root not assigned to

protected override void OnTick()
        {
            CheckForEMA();
            var positions = Positions.FindAll("calgooob", Symbol, TradeType.Buy);
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position); 

Spotware said:

is there any link or source might be useful to understand the codes and variables to be used if I would like to work on a robot using bars

OnBar - you can use it to execute you logic on each incoming Bar.

but with a major problem if I operate the robot it close all other opened positions with

It closes all positions because you iterate through all positions and call ClosePosition. It's up to you what positions should be closed.

 

hiba7rain said:

Thanks its working perfectly but with a major problem if I operate the robot it close all other opened positions with

if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

Any suggestions??

Regards,

Spotware said:

 

one is via stop loss parameter 

You set the stoploss on executing market order. So no extra actions needed there.

 ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);

 

other by value of ask price against EMA is it possible to do so? if yes how to?

        protected override void OnTick()
        {
            CheckForEMA();
        }

        private void CheckForEMA()
        {
            if (ema1.Result.LastValue > Symbol.Ask)
            {
                foreach (var position in Positions)
                {
                    ClosePosition(position);

                }
            }

        } 

 

other by value of ask price against EMA

is it possible to do so? if yes how to?

 

hiba7rain said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

 

Hi Spotware, 

what could be wrong with the following , my intention to create  two different methods to close position one is via stop loss parameter and other by value of ask price against EMA

is it possible to do so? if yes how to?

private void Open(TradeType tradType)
        {

            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "calgoo", StopLossInPips, TakeProfitInPips);
            Print(LastResult.Position.TradeType);
        }


        private void Close()
        {
            foreach (var position in Positions)
            {
                ClosePosition(position);

            }

            if (ema1.Result.LastValue > Symbol.Ask)
            {
                Close();
            }

        } 

 

 

 

 

 


@hiba7rain

snowchilli
06 Oct 2020, 12:31

RE: RE: RE:

Spotware said:

Antonma said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

Ok, thank you for the clarification. What about the volume? How can I get the volume (not tick count) associated to the bid change?

Regards,

Anton

There is no such functionality.

 

6 years later ... How close is Spotware to providing access to the 

  • number of traded lots (or volume)
  • TradeType (opening direction)

for each tick event in cTrader?

(e.g. something like  Bars.Tick.Lots  )

This is essential to judging a bar's weight.


@snowchilli

PanagiotisCharalampous
06 Oct 2020, 12:38

Hi snowchilli,

There is no such information in OTC markets so you cannot expect to have this in a CFD platform.

Best Regards,

Panagiotis 

Join us on Telegram


@PanagiotisCharalampous

uzairmaster97
22 Aug 2021, 17:19

Multiple Symbol Tick Volume

Can someone write me a general code to get Tick Volume data of multiple symbols in a single window?


@uzairmaster97

PanagiotisCharalampous
23 Aug 2021, 11:26

Hi uzairmaster97,

If you need custom development services, you can contact a Consultant.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous