MarketInfo(NULL, MODE_TICKVALUE)

To add comments, please log in or register
paul selvan
629
paul selvan  

hello


double tickValue = MarketInfo(NULL, MODE_TICKVALUE);

 EA strategy tester gives tickValue = 1 , instead of tickvalue in the deposit currecy

So this instruction wont work while in strategy tester ?

Thnaks

Marco vd Heijden
Moderator
12666
Marco vd Heijden  

Did you try any other instrument other then NULL ?

Chidera Anakpe
7641
Chidera Anakpe  
paulselvan:

hello


 EA strategy tester gives tickValue = 1 , instead of tickvalue in the deposit currecy

So this instruction wont work while in strategy tester ?

Thnaks

Replace NULL with _Symbol
paul selvan
629
paul selvan  

When these instructions are used in Indicators 

double tickValue1 = MarketInfo(Symbol(), MODE_TICKVALUE);
double tickValue2 = MarketInfo(_Symbol, MODE_TICKVALUE);
double tickValue3 = MarketInfo(NULL, MODE_TICKVALUE);

they all work perfectly but when in EA strategy tester, they all give value '1' Can we get around this pb

paul selvan
629
paul selvan  

Even when :

double tickValue = MarketInfo("EURUSD", MODE_TICKVALUE);


tickValue = 1


Does the pb come from AdmiralMarket demo a/c

Keith Watford
Moderator
20313
Keith Watford  
paulselvan:

Even when :

double tickValue = MarketInfo("EURUSD", MODE_TICKVALUE);


tickValue = 1


Does the pb come from AdmiralMarket demo a/c

Is the account currency $?

If so, 1 is correct.

paul selvan
629
paul selvan  
Keith Watford:

Is the account currency $?

If so, 1 is correct.

a/c currency is €

Used in indicator, the instruction   

double tickValue = MarketInfo("EURUSD", MODE_TICKVALUE)

gives tickValue = 0.82194....

William Roeder
20207
William Roeder  
  1. double tickValue = MarketInfo(NULL, MODE_TICKVALUE);
    • You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, MarketInfo does not. OrderSend does not.
    • Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
    • Zero is the same as PERIOD_CURRENT which means _Period. Don''t hard code numbers.
    • MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].

  2. paulselvan: a/c currency is € gives tickValue = 0.82194....
    double tickValue = MarketInfo("EURUSD", MODE_TICKVALUE);
    That means a move of 1 pip (0.00010) is worth 8.21€/lot or $10.00 USD/lot. 10/1.22xxx=8.2
    1. In code: Risk depends on your initial stop loss, lot size, and the value of the pair.
      1. You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
      2. Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
      3. Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
                  MODE_TICKVALUE is not reliable on non-fx instruments with many brokers.
      4. You must normalize lots properly and check against min and max.
      5. You must also check FreeMargin to avoid stop out
      Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5=0.1 Lots maximum.
    2. Use a GUI EA like mine (for MT4): Indicators: 'Money Manager Graphic Tool' indicator by 'takycard' Forum - Page 6
paul selvan
629
paul selvan  
thanks for infos whroeder1
To add comments, please log in or register