
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
the thesis: movement=life, rest=death. What does it say in the log? it's at the bottom right two tabs
if i had one - i would check and fix it ...
Forum on Trading, Automated Trading Systems and Strategy Tests
Questions from Beginners MQL4 MT4 MetaTrader 4
Ilya Prozumentov, 2017.06.11 13:53
There is a class template for working with an array.For this template class, we need to implement sorting, given that the array can store complex data types. For example:
ArrayList<PP*> *dde; // PP - класс
I can write different functions for simple and complex types, but compiler doesn't understand that functions are rigidly delimited by data type and keeps swearing:
'<' - illegal operation use ArrayList.mqh
So I decided to embed the interface:
All parts of the construct compile. But if you try to declare it:
ArrayList<PP*> *dde; // PP - класс
then, when compiling the file, these are the errors:'QuickSorts' - template mismatch varQSort.mqh /*error 1*/
'=' - type mismatch ArrayList.mqh /*error 2*/
P.S.What should I fix in the code to eliminate this type mismatch? I don't understand why it occurred in the first place.
'<' - illegal operation use varQSort.mqh
haunts me in this construct as well. It is this very error I wanted to get rid of. But I understand this error, and I don't understand those two.
I need, for example on Monday, if I need to open 2 or 3 trades, the function compares the time and sends the pipe, but I have one time compared so far.
Because when you press the "download" button, 6 000 000 quotes will be downloaded. Not everyone wants to fill up the hard disk with quotes data, wait for a long time until they are downloaded, and then remove unnecessary data from the table of quotes.
Hello Dear ... Can you tell me why the specified trailing stop code for BUY orders works correctly ...
... ... but the same one for SELL orders doesn't set SL...
... The reason is most likely in the condition(Ask+8*D*Point)<OrderStopLoss(), if we remove it, SL will be set, but Trailing Stop works incorrectly without the specified condition ...
ForBUY orders,the condition(Bid-8*D*Point)>OrderStopLoss(), ifOrderStopLoss()==0, is acceptedcorrectly (i.e. some value > 0) ...
... Butthe condition(Ask+8*D*Point)<OrderStopLoss(),OrderStopLoss()==0 is notcorrect ( i.e. somevalue is< 0
) ...Please advise how to correctly formulate in the code the required condition(Ask+8*D*Point)<OrderStopLoss()for correct work ofTrailing Stop withSELL orders.
I thank all of you who replied in advance
.Good afternoon: There is a function where the indicator reads thetick history file . But it is read only once, when the indicator is loaded or updated. How can I make it read every time when the first tick of the zero bar appears?
void ProcessOldCandles(int limit, TickStruct &lastTick)
{
int hTicksFile = FileOpen(Symbol() + ".tks", FILE_BIN | FILE_READ | FILE_SHARE_READ | FILE_SHARE_WRITE);
if (hTicksFile < 1)
return;
TickStruct tick;
while (!IsStopped())
{
if (!IsReadTimeAndBidAskOfTick(hTicksFile, tick))
return;
if (tick.time >= Time[limit])
break;
}
lastTick = tick;
int barIndex = iBarShift(NULL, 0, tick.time);
while (barIndex >= 0)
{
if (!IsReadTimeAndBidAskOfTick(hTicksFile, tick))
return;
if (!IsTickBelongToBar(tick, barIndex))
barIndex = iBarShift(NULL, 0, tick.time);
ProcessOneTick(barIndex, tick, lastTick);
}
FileClose(hTicksFile);
Hello Dear ... Can you tell me why the specified trailing stop code for BUY orders works correctly ...
... ... but the same one for SELL orders doesn't set SL...
... The reason is most likely in the condition(Ask+8*D*Point)<OrderStopLoss(), if we remove it, SL will be set, but Trailing Stop works incorrectly without the specified condition ...
ForBUY orders,the condition(Bid-8*D*Point)>OrderStopLoss(), whenOrderStopLoss()==0 is takencorrectly (i.e. some value > 0) ...
... Butthe condition(Ask+8*D*Point)<OrderStopLoss(), whenOrderStopLoss()==0 is not consideredcorrect (i.e. some value is< 0
) ...Please advise how to correctly formulate in the code the required condition(Ask+8*D*Point)<OrderStopLoss()for correct work ofTrailing Stop withSELL orders.
I thank all of you who replied in advance
.Hi all ... something very low activity in this forum branch ... the problem is solved this way ...
... It's a little long, but it works... Who knows how to make it shorter, can you shorten it, I'd appreciate it... the rest of us can use it as it is.
enter the function
OrderCloseByTicket (542534564)
Close order by ticket with full lot.
so that you don't have to specify lots, price, slippage.
similar to clicking a cross on the order in the terminal.
enter the function
OrderCloseByPos (0)
close the order by position.
and then there will be no need to prescribe these cumbersome constructions.
Hello! The two minus numbers q and w are compared incorrectly, when they are equal, the if operator thinks one is greater than the other.What is the error? When q = -0.0002 and w is also -0.0002, res12=false, why?