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

 

(Previous part here)


Hello, Could you suggest a function in mql4, which among several open buy positions, starting from the lowest price, counts the specified number of lots (sum) and outputs the price below which this number of lots are. Orders are market orders. And the same, but for sell.

To clarify, all orders with different number of lots. The function sums the orders in ascending OrderOpenPrice, as long as the condition "sum of lots <=sum" is true.

 
pechenuga:

(The previous part here)


Hello, Could you suggest a function in mql4, which among several open buy positions, starting from the lowest price, counts the specified number of lots (sum) and outputs the price below which this number of lots are. Orders are market orders. And the same, but for sell.

To clarify, all orders with different number of lots. The function sums the orders in ascending OrderOpenPrice, as long as the condition "sum of lots <=sum" is correct.


What should this function return, the total number of lots, the difference between total and given number of lots or false-true depending on whether the actual value is higher or lower than the given one?

More precisely, what price are we talking about, the opening price of the last order if the volume is higher or equal to the specified one?

 

that's it...my pot is boiling....

if you remove the MEDIUM check from this code, the lines start drawing clearly.

If you return it to the way it is...the EA draws nothing at all!

who has seen an error? or the reason? please tell me.

the compiler shows no errors

Ma_1=iMA(NULL,PERIOD_H1,30,0,MODE_SMA,PRICE_CLOSE,1) ; 
Ma_2=iMA(NULL,PERIOD_H1,60,0,MODE_SMA,PRICE_CLOSE,1);

if ( Hour()>=10 && Hour()<20) 
   {  
      if 
        ( Ma_1>Ma_2)         
              
 { SetVLine(Blue, "", 0, 0, 1);} 

}
 
Please advise which Expert Advisor is the best to use to visualise trading. Again, it would be desirable to be able to use different TFs at the same time. I would like to use both of them at the same time. Thank you!
 
lottamer:

that's it...my pot is boiling....

if you remove the MEDIUM check from this code, the lines start drawing clearly.

If you return it to the way it is...the EA draws nothing at all!

who has seen an error? or the reason? please tell me.

the compiler shows no errors


Show SetVLine();
 
rigonich:

Show SetVLine();

//==========================
//+----------------------------------------------------------------------------+
//| Author : Kim Igor V. aka KimIV, http://www.kimiv.ru |
//+----------------------------------------------------------------------------+
//| Version : 02.07.2008 |
//| Description : Setting the object OBJ_VLINE vertical line |
//+----------------------------------------------------------------------------+
//| Parameters: |
//| cl - line colour |
//| nm - name ("" - time of the current bar opening) |
//| t1 - time (0 - opening time of the current bar) |
//| st - line style (0 - simple line) |
//| wd - line width (1 - default) |
//+----------------------------------------------------------------------------+
void SetVLine(color cl, string nm="", datetime t1=0, int st=0, int wd=1) {
if (nm=="") nm=DoubleToStr(Time[0], 0);
if (t1<=0) t1=Time[0];
if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_VLINE, 0, 0,0;)
ObjectSet(nm, OBJPROP_TIME1, t1);
ObjectSet(nm, OBJPROP_COLOR, cl);
ObjectSet(nm, OBJPROP_STYLE, st);
ObjectSet(nm, OBJPROP_WIDTH, wd);
}
 
rigonich:


Should the function return the total number of lots, the difference between the total and the specified number of lots, or false-true, depending on whether the actual value is higher or lower than the specified one?

More precisely, what price are we talking about, the opening price of the last order if the volume is greater than or equal to a given volume?

The function should return the price below which the orders with the required number of lots are located. That is, as soon as the number of lots is greater than "sum", the function will return the price of that last order
 
lottamer:

Ma_1=iMA(NULL,PERIOD_H1,30,0,MODE_SMA,PRICE_CLOSE,1) ; 
Ma_2=iMA(NULL,PERIOD_H1,60,0,MODE_SMA,PRICE_CLOSE,1);
if(TimeHour(iTime(Symbol(),0,0))>10&&TimeHour(iTime(Symbol(),0,0))<20)
   {
   if(Ma_1>Ma_2)SetVLine(Blue, "", 0, 0, 1);
}  
 
rigonich:



your code does not work!!! :)))))))))))))))) no lines are drawn.

and the time has nothing to do with it. The time is correct. I was outputting it on print...

And if instead of comparing to averages, put a comparison to stochastics - everything is clearly drawn.

Stoch_1=iStochastic(NULL,PERIOD_M5,5,3,3,MODE_SMA,0,MODE_MAIN,1); 
Stoch_2=iStochastic(NULL,PERIOD_M5,5,3,3,MODE_SMA,0,MODE_SIGNAL,1);


if ( Hour()>=10 && Hour()<20)  
// if ( Ma_1>Ma_2)          // убрал средние
//    {
                      
         if (Stoch_1>Stoch_2)
 { SetVLine(Blue, "", 0, 0, 1);}   
 

it looks likerigonich is boiling too :))))

just to be sure, I copied all the components from another working EA...

DID NOT DRAW!

changed "draw" to "buy and sell".

NOT WORKING!

it looks like MAGICAL BLEEP!

Printed out the averages both show 134, while their period differs by a factor of 20 (!)!

 
lottamer:

it looks likerigonich is boiling too :))))

just to be sure, I copied all the components from another working EA...

DID NOT DRAW!

changed "draw" to "buy and sell".

NOT WORKING!

it looks like MAGICAL BLEEP!


Where do you check, on the demo or in the tester?
Reason: