Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 223

 
cripple:

Did you think it was something like this?

Approximately yes. Only you should take into account that the numbering of bars is from zero, and what iBarshift returns, I don't remember whether it returns the right one or one more.

What was the result?

 
novikov433:
For example, if the market went in the required direction and then went back, you just need to close the position at breakeven and open it for reverse. If you want to get an idea what the real reason for that is - to start a trading session with an Fx open account.

Dear novikov433!!! I'll teach you programming, explain everything, show you and write you a free Expert Advisor for your strategy!!! I will explain every line of it! In exchange teach you how to close the deal at breakeven. You can use a simple example. I give my wife an order (order): buy a bucket of potatoes early in the morning at the market, and by 10 o'clock (fundamental analysis) the price goes up - sell. But sometimes a truckload of potatoes arrives at 10:30 (news). And the price (on the news) instantly goes down and it lasts till the end of the day, or even for the whole week. I put a Stop Loss - if the price goes down by 10 rubles, I sell as soon as I can (at the market price). How to change the order, to avoid losses. If you're interested in such a variant - contact me in person.

The question is whether you shouldtrade with your hands - well, the truth is only a quarter of it. You have to be like a fisherman - sit and wait for the bait. On average, two trades an hour. And you have to analyze every deal you make. Open the Account History tab and drag and drop the necessary line on the chart. Objects will appear, among them the trend line from the beginning to the end of the trade. If it is not easily visible, make it bolder. Click on it twice - it will be highlighted. Move it by its ends to make it more profitable. Understand where the entry and exit should have been.

Scroll through the chart. You'll see long stretches of a steady trend. These are the only ones to use.

Open one chart on M1, roll up the rest. Just look at the chart for 5 hours a day for a month - let it be deposited in your subconscious. Write a script for scrolling through the chart 10 times faster. Filling the subconscious will speed up.

When you get the 10-fold increase in profitability, you may start a real trading robot. When you get a 10-fold increase in funds - you can go for real. Put only $ 3 with a leverage of 500. If you manage to double it a couple of times - it will be a solid deposit. If you lose, you will go back to the demo. If you lose the deposit three times - exchange your skates to a sledge.

Keep in mind that for the first half of the year, or even the whole year, your job is to learn. The income will come later.

About the complexity of programming - so it is done on purpose, that fewer people would try to use it. Protection against strangers.

 
Alexey Viktorov:

Approximately yes. Only you should take into account that the numbering of bars is from zero, and what iBarshift returns, I don't remember whether it returns the right one or one more.

What was the result?

You're right, it's 1 more.
 
Alexey Viktorov:

Approximately yes. Only you should take into account that the numbering of bars is from zero, and what iBarshift returns, I don't remember whether it returns the right one or one more.

What was the result?


Print(bars);

I saw the following:

0       18:35:04.537    help EURUSDpro,M5: 0
--/--/--
0       18:35:57.361    help EURUSDpro,M5: 0
0       18:35:59.054    help EURUSDpro,M5: 1
--/--/--
0       18:36:57.551    help EURUSDpro,M5: 1
0       18:37:03.141    help EURUSDpro,M5: 2
--/--/--
0       18:37:58.325    help EURUSDpro,M5: 2
0       18:37:58.564    help EURUSDpro,M5: 3
--/--/--
0       18:38:54.424    help EURUSDpro,M5: 3
0       18:39:02.045    help EURUSDpro,M5: 4
--/--/--
0       18:39:57.791    help EURUSDpro,M5: 4
0       18:39:59.344    help EURUSDpro,M5: 0
0       18:39:59.344    help EURUSDpro,M5: 5
0       18:39:59.653    help EURUSDpro,M5: 0
0       18:40:00.839    help EURUSDpro,M5: 0
0       18:40:01.040    help EURUSDpro,M5: 0
0       18:40:03.093    help EURUSDpro,M5: 0
0       18:40:07.846    help EURUSDpro,M5: 0

It's just not clear:

0       18:39:59.344    help EURUSDpro,M5: 0
0       18:39:59.344    help EURUSDpro,M5: 5
0       18:39:59.653    help EURUSDpro,M5: 0
 
Renat Akhtyamov:
You're right, one more is needed.

Why 1 more? At the moment there are 5 M1 bars on M5.
 
cripple:

Why 1 more? At the moment there are 5 M1 bars on M5.
This is a peculiarity of Bars. I recently struggled with it myself - I couldn't understand - why zero bar is not taken into account...?
 
cripple:


Seen the following:

Only it's not clear:

There's a lot of confusion with the time. The log is written according to local time, but the bars are counted according to server time. Can't even assume anything.

ps; Try taking iTime outside and putting it in the printout.

 
Renat Akhtyamov:
It's a peculiarity of how Bars work. I recently struggled with it myself - I couldn't understand why the zero bar is not taken into account...?

Bars andiBarShift, these are different functions
 
Alekseu Fedotov:

Bars andiBarShift, these are different functions

Yeah, especially if you compare Bars in MT5 and MT4

i'm talking about the 5-rosh...

 
Renat Akhtyamov:

Yeah, especially if you compare Bars in MT5 and MT4

I'm talking about the 5-rosh...


Bars are four-rounder.
Reason: