Spread Array vs MarketInfo(Symbol(), MODE_SPREAD)

To add comments, please log in or register
MarkJoy
43
MarkJoy  

Hello,

I saw that the below code prints 2 different values. Question is why?

Is it correct that Spread[] contains spread values at open time? and MarketInfo contains current spread value?


int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &Time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &Spread[])
{
ArraySetAsSeries(Spread, true);
Print(Spread[0]);
Print(MarketInfo(Symbol(), MODE_SPREAD));

}
iztrader
52
iztrader  
MarkJoy:

Hello,

I saw that the below code prints 2 different values. Question is why?

Is it correct that Spread[] contains spread values at open time? and MarketInfo contains current spread value?


I think the Spread array contains an average spread for that bar/candlestick.
MarketInfo() is definitely returning the current, actual spread.

To add comments, please log in or register