
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
How do I make the EA remember the price that was at the execution of the condition that at 9-20 RSI crossed the level and 20 minutes later there is a price check. And I need to compare the price 20 minutes ago and now
then count in seconds, 20 minutes * 60 seconds = 1200
Compare the current RSI and the one that was 1200 seconds before...
then count in seconds, 20 minutes * 60 seconds = 1200
compare current RSI with the one 1200 seconds before...
if (Hour()==9&& (Minute() ==20) && (RSI>70))
Price2==Bid;
{
if (Hour()==9&& (Minute() ==40) && (Bid<Price2))
{
ticket=OrderSend(Symbol(),OP_SELL,Lts,Bid,SP,0,0,NULL,Magic,0,Blue);
return(0);
}
}
Can you do it like this?)))
if (Hour()==9&& (Minute() ==20) && (RSI>70))
Price2==Bid;
{
if (Hour()==9&& (Minute() ==40) && (Bid<Price2))
{
ticket=OrderSend(Symbol(),OP_SELL,Lts,Bid,SP,0,0,NULL,Magic,0,Blue);
return(0);
}
}
Can you do it like this?)))
You need to remember the time for the countdown and check it to make sure 1200 seconds have elapsed. Track the time with theTimeCurrent function.
andPrice2 can be watched on history, in the past, why remember it?
{
LastTime = TimeCurrent();
//проверяем текущий РСИ и тот что был 1200 секунд назад
}
...when modifying incorrect stoploss - the log should have an error "disabled stoploss".
Why be so complicated when the ticket is there?
Ticket=OrderSend(NULL,OP_BUY,Lot,Ask,slippage,0,0,NULL,magic,0,Blue);
//не забываем проверить код ошибки
if(Ticket<0) Print("Ой, ошибочка: ", _LastError);
TP=NormalizeDouble(Bid+TakeProfit*Point,Digits);
bool modify=OrderModify(Ticket,OrderOpenPrice(),OrderStopLoss(),TP,0);
//не забываем проверить код ошибки
if(!modify) Print("OOPS! Modify error: ", _LastError);
Everything works now:
Ticket=OrderSend(NULL,OP_SELL,Lot,Bid,slippage,0,0,NULL,magic,0,Red);
if(OrdersTotal()!=0)
{
for (int i = 0; i < OrdersTotal(); i++)
{
if(OrderSelect(i,SELECT_BY_POS)==true)
{
TP=NormalizeDouble(Ask-TakeProfit*Point,Digits);
bool modify=OrderModify(OrderTicket(),OrderOpenPrice(),0,TP,0,0);
}
}
return;
}
The problem was the lack of SL, even if the trawl stands afterwards.Thank you all.
Vladymyr Glushko
Forum on trading, automated trading systems and testing trading strategies
MetaEditor build 1470
Vladymyr Glushko, 2016.11.12 04:24
Good day to you.
I am a newbie in trading, so there are a lot of questions, including software questions, in my case this is MT4.
What is the deal , is it possible to make the spread of the currency pair , for example, displayed on the chart window as a number , and in the same way the indicator ATR ?
So, no graphs, just numbers
Example
ATR (14) - 33
Spred 27
I think it would be convenient to use this view of the market situation, it's more convenient and quick to estimate from the averages.
The second point is moving stop based on ATR.
Is it possible to make it automatic?
If you sit in a pose, thanks to the calculator and good eyesight, you can calculate and set a stop manually - no problem.
And if you make this process automatic, it is a good solution for traders, even if they have drawbacks, but in a good trend the trailing stop will reduce the risk of a wrong stop.
Thanks in advance.
Hi! It is written everywhere that an indicator written in mql4 cannot have more than 8 buffers. Ok, but in the comment of a commercial indicator for mt4 (from mql5.com marketplace), the indicator author says, that when using iCustom function, use buffers #9 and #10 ... I read about some additional buffers elsewhere ... Help me to understand how many buffers an indicator may have with current mql4... How to set the numbers of buffers (maybe it's in this case) ?
The information about 8 buffers is outdated
In the new MQL4 you can set up to 512 buffers.
In order to understand it, see indicators source code in MQL4\Indicators\Examples folder. And read documentation