[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 18

 

hello!

I'm writing a ToR and I don't know how to make the conditions when the price crosses the line,
I have no idea how to do it,
I have settled on this one:


1. if openis below and close is above the line, count as crossing from bottom to top
2. if open above and close below the line, count as crossed from upside down
3. open and close above the line and high above, low below the line are considered as crossed from upside down
4. open and closebelow the line andhigh above, low below the line are considered as crossed from bottom to top


Thank you in advance!



 
Digamma: I am writing a ToR and do not know how to correctly make conditions when the price crosses the line

Maybe it would be enough for you to analyse where the previous bar was - under the line or over the line and where the bar is analysed?

i.e. if(High[2] < Y_line && Low[2] < Y_line) // bar number 2 was under the line

but it is better to write such condition if(High[2] < Y_line) - we know that High[2] is always greater than Low[2]

SZZ: From your drawings it is hard to suggest how the price moved, it always starts from open and will form a high and low, in what sequence we can only find out using the lower TF, the close analysis in this situation is meaningless, because the older the TF, the greater the number of times the price updated high and low. Remember how the price forms a new bar online?

 
markich:
Can you delete what and where? So that you don't delete something you need


I see you haven't been helped... Let's try:

0. Close the terminal if it's open.

Look for the history file here: C:\Program Files\MT4\history\... (instead of MT4 - your broker's name)

2. Here you will most likely have several folders (demo and real account history), choose the account folder and look for the file "GBPUSD15.hst".

3. Delete it (or copy it to a separate place) and start the terminal.

Update history (F5)

 
IgorM:

Maybe it would be enough for you to analyse where the previous bar was - under the line or over the line and where the bar is analysed?

i.e. if(High[2] < Y_line && Low[2] < Y_line) // bar number 2 was under the line

but it is better to write such condition if(High[2] < Y_line) - we know that High[2] is always greater than Low[2]

SZZ: From your drawings it is hard to suggest how the price moved, it always starts from open and will form a high and low, in what sequence we can only find out using the lower TF, the close analysis in this situation is meaningless, because the older the TF, the greater the number of times the price updated high and low. Remember how the price forms a new bar online?

thank you!

is there anything else besides bars to analyze this situation

 
Digamma:

hello!

I'm writing a ToR and I don't know how to make the conditions when the price crosses the line,
I have no idea how to do it,
I have settled on this one:


1. if openis below and close is above the line, count as crossing from bottom to top
2. open above and close below the line are considered as crossed from upside down
3. open and close above the line and high above, low below the line are considered as crossed from upside down
4. open and closebelow the line andhigh above, low below the line are considered as crossed from bottom to top


Thank you in advance!



Two more options have been forgotten
 

Gentlemen pros. Question.

What happens to the data in the EA when reconnecting.

I.e. there is a variable declared at the beginning, say a=0, in the process of work it will be assigned value 4. and reconnect to the server will happen. what will happen to it with this a ?

 
Myth63:

Gentlemen pros. Question.

What happens to the data in the EA when reconnecting.

I.e. there is a variable declared at the beginning, say a=0, in the process of work it will be assigned value 4. and reconnect to the server will happen. what will happen to it with this a ?

Nothing will change with the variable a and its value, and if, for example, an order has been allocated, the allocation will be cancelled.
 
TarasBY:
Nothing will change with the variable a and its value, and if, for example, an order has been allocated, the allocation is cancelled.


i.e., the values of the variables are saved and the EA starts working after the start function? and not from the very beginning? until the log file shows that the EA is loaded?

 
Please suggest a script that would display the internal structure of the bar where the marker is set (icon or vertical line), ie at the current TF set the marker on the bar of interest, and below is drawn the internal structure of the bar with one of the lower TF
 
Help me deal with arrays passed to iMAOnArray function.
For some reason, this function works only with buffer array (in VMA example)
and won't work with "regular" (SMA, for example).

Below is an outline of how I do it in my programs. What's wrong?

double MA1[],MA2[],VMA[],SMA[];

int init()
{

   SetIndexBuffer(0,MA1);
   SetIndexBuffer(1,MA2);
   SetIndexBuffer(2,VMA);
   SetIndexEmptyValue(0,0.0);
   SetIndexEmptyValue(1,0.0);
   SetIndexEmptyValue(2,0.0);  
   ArrayResize(SMA,1);  
   ArrayInitialize(SMA,0);

 return(0);
}

int start() 
{  
 
SMA[i]=...........;
VMA[i]=...........;

MA1[i]=iMAOnArray(SMA,0,8,0,0,0); //----этот вариант НЕ работает
MA2[i]=iMAOnArray(VMA,0,8,0,0,0); //----этот вариант всегда работает  
   
  return(0);
}

Reason: