[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 134
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
Here's the problem I'm having.
Working on PERIOD_H1.
To close at the end of the hour I do this:
To open a position at the beginning of the hour, I do thisBut for the test it goes like this
I can't figure out where I'm going wrong.
Not all times it works this way, but it has such moments.
Thanks, who responds :)
A friend gave me a tip:
Instead of TimeCurrent().
TimeSeconds(TimeCurrent())
And it worked.
Can you tell me how to write:
Price has crossed the horizontal line up....
And how should this line be described?
The description of the horizontal line is a constant number, i.e. its value in the indicator window dimension. Let's put the mouse cursor over it and see this value.
Thank you very much for the clarification!
Only I'm concerned about the tester simulating one-minute bars for modifications at the opening of each one-minute bar.
I'll try changing Open[0] to iOpen(NULL,1,0) and adding a function to check the opening of the one-minute bar.
A few minutes passed, during which I tweaked the code and tried it with the tester at M5 and made sure that in this case the tester does not open 1-minute bars, although prescribed, and modifies it only every 5 minutes, which I was afraid of. In all ticks mode it is a bit better, because it modifies more often. But on M1 only on bar opening it works the same, both with Open[0] and with iOpen(NULL,1,0), for which I'm still grateful!
Now I will always use green iOpen, as I see that I can do without red Open. Green profit is nicer than red loss. (:))
If the indicator value on the first bar is greater than the value of the horizontal line, AND, the indicator value on the second bar is less than the value of the horizontal line, then the indicator line has crossed the horizontal line from below to above.
The description of the horizontal line is a constant number, i.e. its value in the indicator window dimension. Let's put the mouse cursor over it and see this value.
Thank you. Now, I'd like to get a bit more settled.
Let's say this level is broken through. The indicator detects the right market condition.
But the price can go back inside this level.
I need not to redefine the previously determined state.
It is important for me to break through this very level. What the price moves back and forth is of no interest to me, because the moment of crossing and fixing of the predefined level is important.
So, what you've written is the situation of the moment. How to make the new determined state remain the same when the price returns.
Our indicator has arrows ARROWDN and ARROWUP on the chart. Maybe they should be applied somehow.
For example, if the value of the current bar is greater than some index AND
Here to put a condition that price has NOT broken the line upwards ( OR ARROWUP is not initiated )..., AND price has NOT broken the line downwards ( OR ARROWDN is not initiated ).
then.... is determined by the state of so-and-so.
The indicator has another expression
( ObjectFind(NameInd+timestartpr+"CurExt_ARROWDN")!=-1) - this kind of telling about the breakdown of the line "CurExt_ARROWDN" downwards.
How can I indicate by the same expression that there is no breakdown?
Thank you. And now I'd like to decide some more.
Let us say that this level is broken through. The indicator defines the required market condition.
But the price could go inside this level again.
And I need to ensure that the previously defined state is not redefined.
As what is important for me is the breakthrough of this level. What the price goes back and forth is of no interest for me, as there is a moment of crossing and fixing of the situation that has already been defined.
So, what you've written is the situation of the moment. How should I make the determined new condition remain unchanged when the price returns?
There are also ARROWDN and ARROWUP arrows on the indicator (on the chart). Maybe they should be applied somehow.
For example, if the value of the current bar is greater than some "AND" index.
Here, put a condition that price has NOT broken the line upwards ( OR ARROWUP is not initiated )..., AND price has NOT broken the line downwards ( OR ARROWDN is not initiated ).
then.... is determined by a state such-and-such.
There is another expression in the indicator
( ObjectFind(NameInd+timestartpr+"CurExt_ARROWDN")!=-1) - this kinda says that the line "CurExt_ARROWDN" has broken down.
How can I specify the same expression, but that there is no breakthrough?
static bool BreakDown=false;
...
as it will be broken:
BreakDown=true;
static bool BreakDown=false;
...
as it runs:
BreakDown=true;
Sanx, can you draw the formula itself? From this point on:
static bool BreakDown=false; // as it will try : BreakDown=true;
static bool BreakUp=false;
if ( iTime(Symbol(),0,0) >= CurExt // start of segment
&& (
ObjectFind(NameInd+timestartpr+"CurExt_ARROWUP")!=-1 // break up
BreakUp=true;
||
ObjectFind(NameInd+timestartpr+"CurExt_ARROWDN")!=-1 // broke down
BreakDown=true;
)
)
Where and how to place BreakUp=true; and BreakDown=true; or better correctly write the formula, pliz.... Otherwise, it's clear that bilibbery is drawn at the top...
Sanx, can I draw the formula itself? From this point on:
static bool BreakDown=false; // breakDown=true;
static bool BreakUp=false;
if ( iTime(Symbol(),0,0) >= CurExt // start of segment
&& (
ObjectFind(NameInd+timestartpr+"CurExt_ARROWUP")!=-1 // break upwards
BreakUp=true;
||
ObjectFind(NameInd+timestartpr+"CurExt_ARROWDN")!=-1 // break down
BreakDown=true;
)
)
Where and how to place BreakUp=true; and BreakDown=true; or better yet, write the formula correctly, pliz.... Because it's clear that bilibberd is drawn at the top...
Sorry, try your own conditions first :) By the way, Breakdown is a breakdown. Not up or down, just a breakdown.
Please tell me the method of calculation. Take for example the last 10 trades and count for example the profitability. How to calculate having a history of all trades (much more than 10) that the profitability of these 10 trades was random/non-random.
Excuse me - but why?
I'm sorry, why?
I'm just trying to get this https://www.mql5.com/ru/forum/139348 thing right. Just don't kick me with thoughts of nonsense and so on. I think "the truth is out there" and maybe part of it is in this thread. So I'm digging.