why is this giving warning ? it should be correct without giving warning .

 
   void Process()
   {
       
       .
       .
       int      TotalSpread ;
       .
       .


      for ( int x = HistoricalBars ; x >= 0 ; x-- )
         {
            .
            .
            TotalSpread = 0 ;
            .
            .



               for ( int y = 0 ; y < NumberOfPairs ; y++ )
               {
                  switch ( ImportList )
                  {
                     case 1  : TotalSpread += MarketInfo ( List[y] , MODE_SPREAD ) ;
                               break ;
                               



                                    .
                                    .
                                    .
                                    .
                                    .

                   }
                 }


                 .
                 .
                 .
                 FileWriteInteger ( Data , TotalSpread , INT_VALUE ) ;
            }



//finish void
}

At TotalSpread += MarketInfo ( List[y], MODE_SPREAD ) ;
it gives me an warning ( possible loss of data due to type of conversion ) when I compile it with strict property . It should be correct as I read the documentation MODE_SPREAD is an Integer type . Why is this happening ?

 
You never try double instead of int ?
 
juniorlcq:

At TotalSpread += MarketInfo ( List[y], MODE_SPREAD ) ;
it gives me an warning ( possible loss of data due to type of conversion ) when I compile it with strict property . It should be correct as I read the documentation MODE_SPREAD is an Integer type . Why is this happening ?


MODE_SPREAD enumerates as an integer, but you are using the function MarketInfo and that returns a double
 
GumRai:

MODE_SPREAD enumerates as an integer, but you are using the function MarketInfo and that returns a double

Ohhhhhhhh, I see, now that make sense, how should I modify it to give no warning then ?
 
DoubleToInteger conversion ?

Edit : But there's no DoubleToInteger
 
juniorlcq:
DoubleToInteger conversion ?

Edit : But there's no DoubleToInteger

                     case 1  : TotalSpread += (int) MarketInfo ( List[y] , MODE_SPREAD ) ;
See Typecasting.
 
I tried TotalSpread += NormalizeDouble ( MarketInfo ( List[y], MODE_SPREAD ), 0 ) ; but still got warning .... NormalizeDouble turn Double type to Integer type isn't it ?
 
angevoyageur:

See Typecasting.

Strange I thought NormalizeDouble and MathRound which should also give no warning like ( int ) .... Why is ( int ) giving no warning but NormalizeDouble still gives warning, mind to explain to me @.@ ?
 
juniorlcq:

Strange I thought NormalizeDouble and MathRound which should also give no warning like ( int ) .... Why is ( int ) giving no warning but NormalizeDouble still gives warning, mind to explain to me @.@ ?
NormalizeDouble and MathRound still return a double. Please check documentation before asking the same question for all functions
 
angevoyageur:
NormalizeDouble and MathRound still return a double.

I'll stick to your suggestion with ( int ), seems like there's no other way of it ... Thanks a lot angevoyageur GumRai deysmacro

" mucks mucks mucks mucks mucks !! "
 
juniorlcq:

I'll stick to your suggestion with ( int ), seems like there's no other way of it ... Thanks a lot angevoyageur GumRai deysmacro

" mucks mucks mucks mucks mucks !! "

Perhaps you prefer this syntax :

  case 1  : TotalSpread += int(MarketInfo ( List[y] , MODE_SPREAD )) ;
Reason: