Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 250

 
Crosswert:


if (Volume[0] > 1) return;


Do not use this kind of check to detect the opening of a new bar, it will not work well in the account, only in the tester. You need to check either by bar time or by the number of bars on the chart

 
Crosswert:


Ha ha... Here's a lie...

The problem turned out to be in the OpenOrders() function. I have completely forgotten to remove control of order opening on a breakdown of a candle (bar):

if (Volume[0] > 1) return;

So, on what TF the Expert Advisor was testing, it was opening orders on those minutes...

Stupid in general, on a hard one...

Thanks...

Better like this(https://www.mql5.com/ru/forum/138609/page482):
bool CheckOpenM15() // Функция возвращает истину при появлении нового бара на М15 (Использовать только в советние)
{
   static int PrevTime=0;
   if (PrevTime==iTime(NULL, PERIOD_M15,0)) return(false);
   PrevTime=iTime(NULL, PERIOD_M15,0);
   return(true);
}
 
Better yet, pass the name of the desired TF to the function
 
artmedia70:
Better yet, pass the name of the desired TF into the function

This is just an example.
 


You know, with / PrevTime / I tried something once, but it never worked. I guess I couldn't get that code into the right place.

With / if (Volume[0] > 1) return; / everything is much simpler. Here, as I believe, everything works for the selected TF. I do not know if it works on a demo but I have not noticed any errors, bugs and other details when opening orders.

But I have not used control of order opening on a new bar for a long time. I have managed to build the function of open positions control. Together with opening orders at a given time, we don't need bar control as such.

The code is just old. Apparently, I forgot about the limitations and bluntly inserted it and continued using it...

 

Can you please tell me how to get the price value of Fibonacci levels?

According to the condition, once the price has crossed the specified Fibonacci levels, a buy or sell trade is opened.

A Fibonacci object is drawn by an Expert Advisor using Kim's function: https://www.mql5.com/ru/forum/107476/page107#606564

It is drawn smoothly without any problems. But then how do we know the price value of the specified level?

This function doesn't seem to work:

OBJPROP_FIRSTLEVEL+n 210+n int Gets/sets the level value of the Fibonacci object with indexn. Index n can be from 0 to (number of levels -1), but cannot exceed 31


Is it possible? Or, should we calculate prices for each level separately starting from OBJPROP_PRICE1 and OBJPROP_PRICE2?

This is nonsense. I was up half the night racking my brains... Of course, nighttime is probably not the best time to look for solutions.

Help please, good people!

 
Lazarechek:

Can you please tell me how to get the price value of Fibonacci levels?

According to the condition, once the price has crossed the specified Fibonacci levels, a buy or sell trade is opened.

A Fibonacci object is drawn by an Expert Advisor using Kim's function: https://www.mql5.com/ru/forum/107476/page107#606564

It is drawn smoothly without any problems. But then how do we know the price value of the specified level?

This function doesn't seem to fit:

OBJPROP_FIRSTLEVEL+n 210+n int Gets/sets the level value of the Fibonacci object with indexn. Index n can be from 0 to (number of levels -1), but cannot exceed 31


Is it possible? Or, should we calculate prices for each level separately starting from OBJPROP_PRICE1 and OBJPROP_PRICE2?

This is nonsense. I was up half the night racking my brains... Of course, night is probably not the best time to look for solutions.

Help, good people!

There was already a similar question:

I want to get the price at a Fibo level of 23.6%
double flevel236 = ObjectGetDouble(0, "Fibo",OBJPROP_LEVELVALUE,1); This one gives 0.236, i.e. not price, but level.
Can you tell me how to get the price of the level. Thank you!

And it has been answered as well:

Just two arithmetic operations. Multiplication (0.236 multiplied by the difference between the prices of level zero and level one) and then addition (the result of multiplication is added to the price of level zero).

 
I wrote an indicator, ran it, everything froze and the message - wait for update (no endless cycles). I restart the mt the result is the same. It is clear that I can delete these indicators before launching and then insert them, but every time to solve the problem this way is not an option. Maybe there is a key to start from the command line to boot into default interface ?
 
artmedia70:

A similar question has already been asked:

I want to get the price at the Fibo level of 23.6%
double flevel236 = ObjectGetDouble(0, "Fibo",OBJPROP_LEVELVALUE,1); This one gives 0.236, i.e. not the price but the level.
Can you tell me how to get the price of the level. Thank you!

And the answer was given as well:

Just two arithmetic operations. Multiplication (0.236 multiplied by the difference between the prices of level zero and level one) and then addition (the result of multiplication is added to the price of level zero).




Thank you kindly!) That's what I thought in principle)


"0.236 multiplied by the difference between zero and first level prices" - only it would probably be more correct to say "between zero and last level prices".

 

Good afternoon people of the forum!

I am relatively new to trading on the exchange, only lost money, in general I decided to implement one idea, but to do this I need to know how to write code, mb it is already in the EAs, if anyone knows, guide me.

In general, the principle of martingale.

Opens on a sell or buy trade with sl and tp = 18

if it played in the + direction we instantly open one more position in the tp direction

if it played negatively, open a x2 position in sl direction after 15 seconds (if possible, this variable has to be set at the beginning)

All in all, if you will help it will be appreciated.

Reason: