Which course I was in?

 

I will deal in two periods chart, one is day chart, another is 30 minute chart, i call them big chart and small chart, in big chart, when the high spot come, I call it A spot, a selling sigal will appear, I will sell one. since then, in small chart, when i meet high spot i will sell only. when the big chart bottom come, when the buying signal appear, I call it B spot, I will buy one, since then, when I meet low spot in small chart, I will buy only. From A spot to B spot, I call it A course, from B to A, I call it B course, my question is, how can I let the the small chart knows which course he is in?

 

Either run an EA on the daily chart to pass the info to the 30 minute EA via a global variable or better code the 30 minute EA to calculate the data from the higher Timeframe. Hard to be more specific from the info given but hope that helps

V

 

I guess you are using two distinct EAs, one for the daily and the other for the 30min chart.

The fastest way is to use global variables, as Viffer mentioned. Ex:

In the daily chart (EA):

GlobalVariableSet("course", 1.0); // 1.0->up, 0->no course, -1.0->down


int the 30m chart(EA):

if(GlobalVariableGet("course")==1.0) // global variables are for real numbers only

{

..... do something here....

}


The other way is to use just one EA.

In the same EA, you can grab information from distinct timeframes. For example:

....iClose(Symbol(),PERIOD_D1, 1);

....iClose(Symbol(),PERIOD_M30, 1);


.... and use them to detect both the course and trade signals from 30min charts, without the need to communicate between EAs.


Regards.

AM

 

Thank you very much for your replay,sirs:
I nearly understand your mean, I also want to know, in day chart,when the selling signal apear,when the event happened, how can I let the day chart say he is in A course from then, I want to know checking what item it will retune 1.0 or -1.0 for us. I considered several metheds to mark the start of the courses, one of them is to use time to mark the start bar of a course, untill it's replaced by next signal bar. I'm a beginner, will you please give me your advices about that?

Reason: