Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 641

 
evillive:

I have 4 digits now, on ewardollar at 1 lot 1 point costs $10 and has always been so. For crosses the cost will be from 8 to 16, the formula is a bit more complicated there.

For example, for the euro pound marketinfo has returned 16.984, the pound-dollar exchange rate = 1.6984, that is, 1 point of the euro pound is worth 1 pound, multiplied by the pound-dollar point value, which is always 10.0 (100000 * 0.0001 = 10.0 or 100000 * 0.00010 = 10.0 - whatever one likes).


All these calculations are correct only if your account is in dollars:

In this case, for xUSD (EURUSD, GBPUSD etc.) tickvalue = lot*point = 100000*0.0001 = 10.0

for USDh (USDCHF, USDJPY etc) tickvalue = lot*point/Bid = 100000*0.01/101.93=9.8107

for xUSD/yUSD (EURGBP) tickvalue = Bid(yUSD)*lot*point = 1.6980*100000*0.0001 = 16.98

for xUSD/USDy (EURJPY) tickvalue = lot*point/Bid(USDy) = 100000*0.01/101.91 = 9.8126


Something you messed up! Took the time to look into the code, selected expressions, and look:

  double TV = MarketInfo(Symbol(),MODE_TICKVALUE); 
  string sTV = DoubleToStr(TV,4); 
  Comment("TV ",sTV); //sTV = 1.0/Bid

It couldn't be simpler! No 10, 16, etc.

 
evillive:

I have 4 digits now, on ewardollar at 1 lot 1 point costs $10 and has always been so. For crosses the cost will be 8 to 16, the formula is a bit more complicated there.

For example, for the euro pound marketinfo has returned 16.984, the pound-dollar exchange rate = 1.6984, that is, 1 point of the euro pound is worth 1 pound, multiplied by the pound-dollar point value, which is always 10.0 (100000 * 0.0001 = 10.0 or 100000 * 0.00010 = 10.0 - whatever one likes).


All these calculations are correct only if your account is in dollars:

In this case, for xUSD (EURUSD, GBPUSD etc.) tickvalue = lot*point = 100000*0.0001 = 10.0

for USDx (USDCHF, USDJPY etc) tickvalue = lot*point/Bid = 100000*0.01/101.93 = 9.8107

for xUSD/yUSD (EURGBP) tickvalue = Bid(yUSD)*lot*point = 1.6980*100000*0.0001 = 16.98

for xUSD/USDy (EURJPY) crosses tickvalue = lot*point/Bid(USDy) = 100000*0.01/101.91=9.8126




This is wrong! The value of a quote doesn't matter!And the value of a min. tick must be calculated from the current price! Which equals TICK_VALUE! Above is an example from my code.
 
borilunad:

borilunad:

This is wrong! The value of a quote is irrelevant! And the value of a min.tick should be calculated from the current price! Which equals TICK_VALUE! Above is an example from my code.

How is it wrong? Marketinfo returns the same values as the formulas I gave above. I didn't invent these formulas, they are used by the terminal to calculate TickValue)))

It's clear that it's more convenient to take the value from Marketinfo, but he was asking for formulas or methods of calculation.

And about the value I wrote earlier, that it does not matter, because on 5-digit counts a point = 10 pips, and it is the same point from 4-digit.

 
evillive:

How is it wrong? Marketinfo returns the same values as the formulas I gave above. I didn't invent these formulas, they are used by the terminal to calculate TickValue)))

It's clear that it's more convenient to take the value from Marketinfo, but he was asking for formulas or methods of calculation.

And I wrote about signification earlier, that it doesn't matter, because on 5-digit counts a point = 10 pips, and this is the same point from 4-digit.


That's what I mean byMarketInfo(Symbol(),MODE_TICKVALUE) =1.0/Bid;Maybe only for Eurodollar, I don't spray it on others!
 
borilunad:

That's what I mean byMarketInfo(Symbol(),MODE_TICKVALUE) =1.0/Bid;Maybe, only for Euro, not for others!

This is exactly what is wrong with the Eurodollar, based on the definition given in the help

MODE_TICKVALUE

16

Minimal change of security price in the deposit currency


And it means to multiply

MODE_POINT

11

Size of the point in the quote currency. For the current symbol is stored in the predefined variable Point


by

MODE_LOTSIZE

15

Contract size in the instrument's base currency


Of course, if your account is in Euro, you should use the Euro as a base currency, but for traders who have a dollar account (they most often do), the above formulas are valid. Because the main and most traded pairs are based on the US dollar, these formulas are most often used.

 
evillive:

This is exactly wrong, based on the definition given in the help

MODE_TICKVALUE

16

Minimal change of symbol price in the currency of deposit


It means this value should be multiplied by

MODE_POINT

11

Size of the point in the quote currency. For the current symbol is stored in the predefined variable Point


at

MODE_LOTSIZE

15

Contract size in the instrument base currency


Of course, if your account is in Euros, you should use Euros, but most traders have a dollar account.


Well, then, I have a special case, but for me who lives in the eurozone, it is more convenient to carry out all calculations in euros!
 

Gentlemen, please give me a code example for the following indicator. I can't figure out how many buffers are needed, what type of mapping and where and what properties should be prescribed for them.

The indicator is the following:

1 The bars connect at least every third and adjacent bar. The line is red.

2 Bar sections connect the maximums of every 5th and adjacent bar. The line is blue.

The main thing: the segments do not intersect in any way. The beginning and the end of each segment are independent of the other segments.

The indicator calculates the values of the beginning and the end of each segment. They should be coloured differently depending on the conditions.

This is roughly what it should look like


 

And another question.

Is it normal that I cannot work with the indicator in Debug mode.

When the program reaches the stopping point, the MT4 terminal hangs and the window becomes white (in HP) so that it is impossible to see what is drawn on the chart

 
Top2n:

Here is the ready code.

Task: Search for trend lines (OBJ_TREND), record price values relative to the current bar in an array. With filtering with respect to existence of object time parameters (OBJ_TREND).

simpleton:Thank you very much, you made me feel the right code!) (Although I didn't understand much))))

If you practice, understanding will come, more and more. It takes concentration and attentiveness. When program algorithm is smeared on one big function, it is difficult to realize it with concentration and attentiveness - too many links are formed. But if a program is divided into functionally complete parts (small functions), it is much easier to do this for each separate small function. And so at each function level. By the way:

   if( DiffInSecs(dt,dt2)>MAX_SECS_AFTER_PRICE2 && DiffInSecs(dt2,dt1)> MIN_SECS_BETWEEN_PRICE1_AND_PRICE2){
    if (!AddValue(array, ObjectGetValueByShift(name, 1))) { // Пытаемся добавить
      return false; // Ошибка, значение не добавлено
    }
  }
I must have misnamed the mnemonic MAX_SECS_AFTER_PRICE2 (because at first I so understood that the condition must be inverse), the meaning should probably be MIN_SECS_AFTER_PRICE2, that is, the minimum allowed, not the maximum.
 
dr0:

Gentlemen, please give me a code example for the following indicator. I can't figure out how many buffers are needed, what type of mapping and where and what properties should be prescribed for them.

The indicator is the following:

1 The bars connect at least every third and adjacent bar. The line is red.

2 Bar sections connect the maximums of every 5th and adjacent bar. The line is blue.

The main thing: the segments do not intersect in any way. The beginning and the end of each segment are independent of the other segments.

The indicator calculates the values of the beginning and the end of each segment. They should be coloured differently depending on the conditions.

This is roughly what it should look like



2 buffers are enough! Prescribe unambiguous conditions for drawing lines, also where lines should not be drawn! Good luck!