Need moneymanagement LOT size formula based on SL and Account Risk!

Back to topics list  | 1 2 3 4 To post a new topic, please log in or register
avatar
Moderator
3427
GumRai 2015.02.06 03:39 #
 
darelco:

... in this part of code is a problem with new compilation (error ---> 'MarketInfo' - illegal switch expression type) perhaps it was all OK until the update to MT4 build 600+ ... but since then it doesn't work any longer.

 So, could you please post some newer version ... if  of course you're still around.


I think if you change

                switch ( MarketInfo( strSymbol, MODE_DIGITS ) )

 to

                int dig=MarketInfo( strSymbol, MODE_DIGITS ) ;
                switch ( dig )

 It will compile ok

avatar
Moderator
3206
angevoyageur 2015.02.06 10:07 #
 
darelco:

... in this part of code is a problem with new compilation (error ---> 'MarketInfo' - illegal switch expression type) perhaps it was all OK until the update to MT4 build 600+ ... but since then it doesn't work any longer.

 So, could you please post some newer version ... if  of course you're still around.


   switch((int)MarketInfo(strSymbol,MODE_DIGITS))

avatar
49
gadget 2015.02.06 11:00 #
 

https://book.mql4.com/operators/switch

"The values of Expression and of Parameters can only be the values of int type. The Expression can be a constant, a variable, a function call, or an expression. Each variation 'case' can be marked by an integer constant, a character constant, or a constant expression. A constant expression cannot include variables or function calls."

avatar
Moderator
3427
GumRai 2015.02.06 12:18 #
 
angevoyageur:
   switch((int)MarketInfo(strSymbol,MODE_DIGITS))

Once again, you come up with a simpler and better solution.
avatar
Moderator
3206
angevoyageur 2015.02.06 12:39 #
 
GumRai:
Once again, you come up with a simpler and better solution.
We all learn from each other.
avatar
13012
WHRoeder 2015.02.06 14:12 #
 
                int dig=MarketInfo( strSymbol, MODE_DIGITS ) ;
                switch ( dig )
or
   switch((int)MarketInfo(strSymbol,MODE_DIGITS))
or the object style (works except for pointer casts)
   switch( int(MarketInfo(strSymbol,MODE_DIGITS)) )
Back to topics list   | 1 2 3 4  

To add comments, please log in or register