Download MetaTrader 5
To add comments, please log in or register
Do you want to deposit to your account? Do this in any convenient way!
Baby Blue
20
Baby Blue 2015.03.03 17:18 
struct market{
   
   double minqty, stepqty, pl, bid, ask;
   int spread, minsl;
   string ticker;
   
   market(){
      minqty = SymbolInfoDouble(ticker,SYMBOL_VOLUME_MIN);
      stepqty = SymbolInfoDouble(ticker,SYMBOL_VOLUME_STEP); 
      pl = AccountInfoDouble(ACCOUNT_PROFIT); 
      ticker = Symbol();
      spread = (int)SymbolInfoInteger(ticker,SYMBOL_SPREAD); 
      minsl = (int)SymbolInfoInteger(ticker,SYMBOL_TRADE_STOPS_LEVEL);
      bid = SymbolInfoDouble(ticker,SYMBOL_BID);
      ask = SymbolInfoDouble(ticker,SYMBOL_ASK);
   }
   
   void update(){
      pl = AccountInfoDouble(ACCOUNT_PROFIT); 
      spread = (int)SymbolInfoInteger(ticker,SYMBOL_SPREAD);
      minsl = (int)SymbolInfoInteger(ticker,SYMBOL_TRADE_STOPS_LEVEL);
      bid = SymbolInfoDouble(ticker,SYMBOL_BID);
      ask = SymbolInfoDouble(ticker,SYMBOL_ASK);
   }
};

market forex;
Is the struct "forex" accessible from every chart in the profile on which the expert has been applied?
Alain Verleyen
Moderator
28536
Alain Verleyen 2015.03.03 23:40  
barando:
Is the struct "forex" accessible from every chart in the profile on which the expert has been applied?

Your question doesn't make sense.

An expert is applied to a chart not a profile.

A struct or any code is never accessible to a chart. It's accessible to the code where it's defined and instantiated.

Baby Blue
20
Baby Blue 2015.03.04 16:46  
angevoyageur:

Your question doesn't make sense.

An expert is applied to a chart not a profile.

A struct or any code is never accessible to a chart. It's accessible to the code where it's defined and instantiated.

So, the struct is not accessible from the same code (ea) applied on another chart, right? I know that this is true for a basic variable, but i was experiencing some strange ea behavior and I wanted to be sure that is the same for struct variables.
Carl Schreiber
5938
Carl Schreiber 2015.03.04 22:51  
barando:
So, the struct is not accessible from the same code (ea) applied on another chart, right? I know that this is true for a basic variable, but i was experiencing some strange ea behavior and I wanted to be sure that is the same for struct variables.
If you apply an EA to two different charts the EA runs twice - each with it own struct!
Baby Blue
20
Baby Blue 2015.03.05 08:06  
gooly:
If you apply an EA to two different charts the EA runs twice - each with it own struct!
Ok thanks.
/
To add comments, please log in or register