0
votes

Here is the image of the custom symbol that I am trying to create:

Image of the custom symbol.

As you can see the values coming are not the values in the DATA section on MT5.

I am trying the following code for that purpose:

      ticks_array[0].time= StructToTime(running);
      ticks_array[0].bid = StringToDouble(s[7]);
      ticks_array[0].ask = StringToDouble(s[8]);
      ticks_array[0].last = StringToDouble(s[5]);
      ticks_array[0].flags= TICK_FLAG_LAST;

      ticks_array[Should_change].time_msc = 0; 
      CustomTicksAdd(symbol_custom,ticks_array);

      rates_add[0].time = Time_For_Rates;
      rates_add[0].open = StringToDouble(s[2]);
      rates_add[0].high= StringToDouble(s[3]);
      rates_add[0].low = StringToDouble(s[4]);
      rates_add[0].close=StringToDouble(s[5]);
      rates_add[0].spread=(int)((StringToDouble(s[8])-StringToDouble(s[7]))*10000);
      rates_add[0].tick_volume=StringToInteger(s[6])-1;
      rates_add[0].real_volume=0;      
      Print(CustomRatesReplace(symbol_custom,Time_For_Rates,Time_For_Rates,rates_add));

Please let know why is this happening and how i can resolve it. EDITED:
Symbol configuration is: uuu.json

2
Please can someone help me with this issue?Jaffer Wilson
Someone please help me with this.Jaffer Wilson

2 Answers

1
votes

Use this:

Price = StrToDouble(DoubleToStr(Price,5));

5 is your Digits. You can change it if you want

1
votes

When creating a symbol - make sure you have enough digits. Your uuu.json says about 6 which is not correct - Digit is used to indicate number of digits after dot.

bool CustomSymbolSetInteger( "uuu", SYMBOL_DIGITS, 5);

No need to normalize (using NormalizeDouble()) if you have digits already.