Is a Public Struct accessible from different charts?

Back to topics list To post a new topic, please log in or register
avatar
10
barando 2015.03.03 18: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?
avatar
Moderator
3206
angevoyageur 2015.03.04 00: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.

avatar
10
barando 2015.03.04 17: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.
avatar
2017
gooly 2015.03.04 23: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!
avatar
10
barando 2015.03.05 09:06 #
 
gooly:
If you apply an EA to two different charts the EA runs twice - each with it own struct!
Ok thanks.
Back to topics list  

To add comments, please log in or register