Download MetaTrader 5
To add comments, please log in or register
Thousands of developers have already published their products in the Market. Join them!
macpee
287
macpee 2016.10.18 01:17 

How come no record for an event as important as REASON_PROFILE in this table, or is there a way to configure it manually or maybe it exists and I do not know? I have made good use of some of the ones listed. However I still need a Constant for REASON_PROFILE for profile change. Any one with a good clue pls. Thank you in advance.

As a matter of fact, when you change profile, what you get is uninit reason 4 because chart actually closed. Hence, in the absence of any open charts as of the time of the profile change, you get NO uninit reason at all.

macpee
287
macpee 2016.10.18 01:35  
Sorry I clicked the submit button forgetting the table, after which I quickly uploaded it, not knowing you have commented already (I had thought as much).
Keith Watford
Moderator
7959
Keith Watford 2016.10.18 05:25  
Hence, in the absence of any open charts as of the time of the profile change, you get NO uninit reason at all.
If no charts are open then there can be no Experts to call OnDeinit
macpee
287
macpee 2016.10.18 08:55  
GumRai:
If no charts are open then there can be no Experts to call OnDeinit
Logical thought !!! Thanks anyway. I should have thought as much. No wonder there are as many uninit reason 4 as there are open charts with EA.
macpee
287
macpee 2016.10.18 09:08  

It means that the PROFILE_CHANGE uninit can be manually created as follows:

OnDeinit()
   {
   if (no chart is open and no uninit reason occurred OR charts are open AND more than one uninit reason occurred)
      {
       profile uninit reason should be assigned the Value 10}

       //however if only one chart is open then I have not figured out what to do, because only one uninit reason 4 will be triggered for REASON_CHARTCHANGE

       //another thing is how to obtain the profile name for further activities. This one is particularly important because we use profile names such as USD, EUR, CAD, JPY, etc 
       //to arrange our charts
      }
   }
whroeder1
13627
whroeder1 2016.10.18 12:21  
  1. If there is no chart open, there is no OnDeinit as there is no EA running.
  2. A change in profile means close all charts, then open new charts. Therefor you get REASON_CHARTCLOSE.
  3. What would you be doing different for a profile change that you wouldn't do for a chart close? (deinit)
  4. What would you be doing different for a profile change that you wouldn't do for a chart open? (init)
macpee
287
macpee 2016.10.18 13:01  
WHRoeder:
  1. If there is no chart open, there is no OnDeinit as there is no EA running.
  2. A change in profile means close all charts, then open new charts. Therefor you get REASON_CHARTCLOSE.
  3. What would you be doing different for a profile change that you wouldn't do for a chart close? (deinit)
  4. What would you be doing different for a profile change that you wouldn't do for a chart open? (init)

Your last two questions seems from someone that have known all the trading strategies there could ever be. If you had said that it was not possible as far as you are concerned, I would have appreciated it.

What I would be doing with profile change is that I  would name my profiles USD, EUR, GBP, JPY, etc where each chart in a profile is for instrument containing the profile name. Now by the time I change to a profile say GBP, then EA would know that I want to trade the instruments containing GBP (and remember all the charts contain GBP instruments as would have been arranged). So that when a news release favours GBP, and I trade on any chosen chart in the profile (say, I go long GBPUSD) then EA would do the same across board. It would go long GBPUSD and go short EURGBP. You can see that in this case I wont have to manually enter the name of the profile anywhere each time I want to trade, only profile change suffices. You may now tell me how chart open or chart close would do that.

A second, less user friendly and in fact DANGEROUS method is to created a pull down menu (or list) for one of the input variables in the properties box of my EA. This input variable contains a list of the currencies (USD, EUR, GBP, JPY, etc) to be entered only by click and select method. The idea is to select from the list (say GBP) and having clicked OK, the EA will take note of the currency GBP for trading the GBP if there is a GBP news available. This method is however less user friendly and would involves changing profile and entering input. Worse still when you have to type the input (profile name of course). Much worse still when you forget to enter the profile name (GBP in this case).

whroeder1
13627
whroeder1 2016.10.18 13:28  
macpee: EA would know that I want to trade the instruments containing GBP (and remember all the charts contain GBP instruments as would have been arranged).
It already knows the symbol contains GBP. It doesn't need to know about the others, the EA on the other charts handles those pairs.
macpee
287
macpee 2016.10.18 14:10  
WHRoeder:
It already knows the symbol contains GBP. It doesn't need to know about the others, the EA on the other charts handles those pairs.
 The strategy is to trade across charts using one EA. Who has the time to browse through charts and EA's trading one at a time when a news release comes out? So I guess the strategy is clear and would be better with profile names. Since some pairs containing say GBP move better than others with news release, and we cannot always say which pair will do better than the other, the idea is to trade all the pairs with small lot sizes to minimize loss.
/
To add comments, please log in or register