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, dear Igor! My system uses trend suppressors. And both the time and the price of the crossover are important in it.
A sequence of bars does not always have a "continuous" time. Exits, holes, etc.
The use of CrossPointOfLines ( in test_CrossPointOfLines.mq4) for calculation of time in its natural form leads to the following results
to the left of the zero bar
(The position of the trend lines on the charts has nothing to do with the system - random selection. The reference points of the trend line can
being one on the left side of the zero bar, the other one on the right).
and to the right
Calculations should not be performed in hours, but according to the situation: both in bars and in hours . The unit of time on the left is bar. And for the right side, after the zero bar, it should be measured in hours.
Search for ready-made solutions hasn't yielded anything yet. The CrossPointOfLines function is the only one on the site so far. It requires a perfect history :(
Good day Igor!
Please help me with advice or a solution. I am trying to make the Expert Advisor give a signal when a previous bar "absorbs" the previous one.
1 - if absorption occurred upwards2 - if absorption occurred downwards.
I thought it was very simple, just compare open and close prices and voila ... but it's not. When I hover my mouse over the previous 2 bars, it's clear that the last one is eating the penultimate one.
Very much hope for help, and thank you in advance
Here is the text:
int start(){
//----
if (SShort()==1)
Alert("1");
}
if (SLong()==1)
Alert("2");
}
//----
return(0);
}
//+------------------------------------------------------------------+
int SShort()
{int MS=0;
if (Open[1]>Close[2] && Close[1]<Open[2] && Open[1]>Close[1] && Open[2]<Close[2])
MS=1;
return(MS);
}
//+------------------------------------------------------------------+
int SLong()
{
int ML=0;
if(Open[1]<Close[2] && Close[1]>Open[2] && Open[1]<Close[1] && Open[2]>Close[2])
ML=1;
return(ML);
}
//+------------------------------------------------------------------+
Time filter set: C and PO
(and more...).
Once asked what's up, here's the result I came up with myself.1. Prohibit or allow daily activities.
Option 1.
Note that the "expiry time" in these options extends to the end of the hour and 59 seconds of the number of minutes.
i.e. the end time of the event indicated as 23:59 is actually 23:59:59
And to the end of the hour because the minutes use the comparison operator ">=", which however is not a problem and you can specify "==",
but wiping the time to 59 seconds will still work in any case...
Option 2.
More precise from the point of view of setting conditions...
The time is set by specifying in passing parameters to function, for example 21:15:23 as (21,15,23).
It's clear that it's not cool, but it's quite workable code...
SZY: the validity check of entered parameters is not accidental.
For if you enter wrong one, it blows your mind. I couldn't find any other way, so I've commented it out.
Therefore, I would be very grateful for a way to solve this problem...
Variant #3.
As it turns out, it's the simplest and the most exact.
The thing about simplicity, it seems, is in peculiarities of transformation of parameters passed to it by function StrToTime().
For example, if you enter only the time "HH:MM:SS" then the output will be the time of each current day...
By the way...
By combining sampling by hours with days you can filter by type:
- what was at 18:00 of each day, or what was every day in specified period from C and up hours:minutes:seconds
However, the range of days can also be crammed in from and to...
2. Function DateFirstDayMonday()
(based on DateOfMonday() )
Returns date of the first day as 00:00:00 of the current month.
Needed to filter events from BEFORE the start of the month...
DateFirstDayMonday()-1 in the second sample prints "last day of previous month 23:59:59".
...
Please don't kick me in advance, because I'm a dummy.
:)))
Please don't kick me in advance, because I am a dummy. :)))
Chayneg not chayneg, but if you've taken up the bush, follow it to the end. We'd like to move permitted operation time and closing time to separate Boolean functions of this type:
bool TradeTime(Trade start time, Trade end time)
Then it will be very convenient to use, if (TradeTime(.,...)) and work!
Chyneg is not a chyneg, but if you've taken up the rudder, follow through. It begs to put allowed operation time, closing time into separate Boolean functions of sorts:
bool TradeTime(Trade start time, Trade end time)
It will be very convenient to use then, if (TradeTime(.,.)) and work!
Well, already... ;)
For one bank I make variant with two simultaneous timings:
- close all orders and positions before the rollover at 22:00
- trade pause from the beginning of the rollover at 22:00 till the end of the day at 23:59
(raw version without additional checks)
...(raw version without additional checks)
Vinin had separate functions for timing, very detailed and worked out. Look in the EAs on his site or knock on his door.
Vinin's EA has separate functions for working with time, which are very detailed and thorough. Look through the Expert Advisors on his site or just knock on his door.
Thanks, but no need for that yet...
I just don't have a lot of time for this advisor at the moment,
I know what to write there and I know how to write it too...
*
I will post the main text on the bank's forum in order not to litter this topic.
In his time, of course. ;)
bool TradeTime(Trade start time, Trade end time)
Then it will be very convenient to use, if (TradeTime(.,.)) and work!
It's necessary to order such a function for Igor Kim.
Igor Kim should order such a function.
I join in the request! It would be a very useful and needed function. In the light of current trading realities....
It is even possible to provide two TIME intervals there.