[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 143

 
todem:

What does a select order have to do with it?

We take the data from the indicator, orders are not involved here


You use OrderSymbol() -- Returns the name of the financial instrument for the currently selected order.
The order must be pre-selected using the OrderSelect() function.

Here is your code:

double CC1=0,CC2=0;
  if(OrderSymbol()=="EURUSD"){ CC1 = iCustom("EURUSD",60,"CC2",3,6,0,1); CC2 = iCustom("EURUSD",60,"CC2",3,6,1,1); }
  if(OrderSymbol()=="GBPUSD"){ CC1 = iCustom("GBPUSD",60,"CC2",3,6,0,1); CC2 = iCustom("GBPUSD",60,"CC2",3,6,2,1); }
  if(OrderSymbol()=="USDCHF"){ CC1 = iCustom("USDCHF",60,"CC2",3,6,0,1); CC2 = iCustom("USDCHF",60,"CC2",3,6,3,1); }
  if(OrderSymbol()=="USDJPY"){ CC1 = iCustom("USDJPY",60,"CC2",3,6,0,1); CC2 = iCustom("USDJPY",60,"CC2",3,6,4,1); }
  if(OrderSymbol()=="USDCAD"){ CC1 = iCustom("USDCAD",60,"CC2",3,6,0,1); CC2 = iCustom("USDCAD",60,"CC2",3,6,5,1); }
  if(OrderSymbol()=="AUDUSD"){ CC1 = iCustom("AUDUSD",60,"CC2",3,6,0,1); CC2 = iCustom("AUDUSD",60,"CC2",3,6,6,1); }
  if(OrderSymbol()=="NZDUSD"){ CC1 = iCustom("NZDUSD",60,"CC2",3,6,0,1); CC2 = iCustom("NZDUSD",60,"CC2",3,6,7,1); }
  if(OrderSymbol()=="EURGBP"){ CC1 = iCustom("EURGBP",60,"CC2",3,6,1,1); CC2 = iCustom("EURGBP",60,"CC2",3,6,2,1); }
  if(OrderSymbol()=="EURCHF"){ CC1 = iCustom("EURCHF",60,"CC2",3,6,1,1); CC2 = iCustom("EURCHF",60,"CC2",3,6,3,1); }
  if(OrderSymbol()=="EURJPY"){ CC1 = iCustom("EURJPY",60,"CC2",3,6,1,1); CC2 = iCustom("EURJPY",60,"CC2",3,6,4,1); }
here CC1, CC2 receive values corresponding to the instrument of the selected order

if you gave us the entire code, we could tell for sure what the problem is instead of guessing

 
100yan:

double MA13=iMA(NULL,..... etc
So you want to first calculate the value of the mask, i.e. some number, and then find out with what period it has been calculated? No, it doesn't work that way))
 
eddy:
Why does MainBuffer[i] exceed 100? Where is the error?
MathMax and MathMin return the bar number, not the extremum itself
 
abolk:


you use OrderSymbol() -- Returns the name of the financial instrument for the currently selected order.
The order must be pre-selected using OrderSelect().

here is your code:

CC1, CC2 get values corresponding to the instrument of the selected order

if you cited all the code, you could tell for sure what the problem is instead of guessing

omit ORDER... so it would be Symbol()
 
Sergey_Rogozin:

The interesting thing is that it gives the same values in all cases.

That is, it gives the same values for all characters.

double CC1=0,CC2=0;
  if(Symbol()=="EURUSD"){ CC1 = iCustom("EURUSD",60,"CC2",3,6,0,1); CC2 = iCustom("EURUSD",60,"CC2",3,6,1,1); }
  if(Symbol()=="GBPUSD"){ CC1 = iCustom("GBPUSD",60,"CC2",3,6,0,1); CC2 = iCustom("GBPUSD",60,"CC2",3,6,2,1); }
  if(Symbol()=="USDCHF"){ CC1 = iCustom("USDCHF",60,"CC2",3,6,0,1); CC2 = iCustom("USDCHF",60,"CC2",3,6,3,1); }
  if(Symbol()=="USDJPY"){ CC1 = iCustom("USDJPY",60,"CC2",3,6,0,1); CC2 = iCustom("USDJPY",60,"CC2",3,6,4,1); }
  if(Symbol()=="USDCAD"){ CC1 = iCustom("USDCAD",60,"CC2",3,6,0,1); CC2 = iCustom("USDCAD",60,"CC2",3,6,5,1); }
  if(Symbol()=="AUDUSD"){ CC1 = iCustom("AUDUSD",60,"CC2",3,6,0,1); CC2 = iCustom("AUDUSD",60,"CC2",3,6,6,1); }
  if(Symbol()=="NZDUSD"){ CC1 = iCustom("NZDUSD",60,"CC2",3,6,0,1); CC2 = iCustom("NZDUSD",60,"CC2",3,6,7,1); }
  if(Symbol()=="EURGBP"){ CC1 = iCustom("EURGBP",60,"CC2",3,6,1,1); CC2 = iCustom("EURGBP",60,"CC2",3,6,2,1); }
  if(Symbol()=="EURCHF"){ CC1 = iCustom("EURCHF",60,"CC2",3,6,1,1); CC2 = iCustom("EURCHF",60,"CC2",3,6,3,1); }
  if(Symbol()=="EURJPY"){ CC1 = iCustom("EURJPY",60,"CC2",3,6,1,1); CC2 = iCustom("EURJPY",60,"CC2",3,6,4,1); }
This is the correct way to do it
 
alsu:
MathMax and MathMin return the bar number, not the extremum itself

MathMax returns the maximum value of 2 values - High[i] and 0, if it encounters a High[i] greater than HighesBuffer[i] - it returns it.

MathMin returns the minimum value of 2 values - Low[i] and 99999, if bumping into Low[i] is less than LowesBuffer[i] - it returns it.

 
alsu:
So you want to first calculate the value of a waving, i.e. some number, and then find out with what period it has been calculated? No, that won't work))

Not really... Is it possible to rely on some MA indicator(not necessarily the value). But I don't know how ...
 
what to lean on? and why?
 
eddy:
What to refer to? And why?

there is a working MA (period can vary)

there is a separate function that uses the same period. For the beauty of the solution, it is necessary to refer to the MA, not its period.

you need to calculate the period of the MA...

 
todem:
That's more like it.

О! Well, of course you are. Something's got my eye. What a gross mistake!

Oh, thank you.

Reason: