I attached a martingale. In the middle of the day I attached the Expert Advisor in this form (it had already made a few deals of the same EA, but in an unfinished state before), - the EA worked fine, the martingale worked, took out losses for half a day in the plus. The next day, I turned on the platform in the morning, went to work, in the evening - one deal. Martingale increases the lot for a losing trade, otherwise - the standard lot.
voidOnTick()
{
datetime EaStartTime = StringToTime(StartTime); // время начала работы советникаdatetime EaEndTime = StringToTime(EndTime); // время окончания работы советникаdatetime CurrTime = TimeCurrent(); // это если нужно взять время терминалаif(CurrTime<EaStartTime || CurrTime>=EaEndTime)
return; // если еще не время торговать - выход
{
MacdCurrent=iMACD(NULL,0,InpFastEMA,InpSlowEMA,InpSignalSMA,Macd_Applied_Price,MODE_MAIN,0);
SignalCurrent=iMACD(NULL,0,InpFastEMA,InpSlowEMA,InpSignalSMA,Macd_Applied_Price,MODE_SIGNAL,0);
SignalMAPrevious=iMA(NULL,0,InpMAPeriod,InpMAShift,InpMAMethod,MA_Applied_Price,1);
SignalMAThis=iMA(NULL,0,InpMAPeriod,InpMAShift,InpMAMethod,MA_Applied_Price,0);
SignalParabolic=iSAR(NULL,0,InpSARStep,InpSARMaximum,0);
SignalStochastic_5=iStochastic(NULL,5,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,0,1,0);
MainStochastic_5=iStochastic(NULL,5,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,0,0,0);
SignalStochastic=iStochastic(NULL,0,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,0,1,0);
MainStochastic=iStochastic(NULL,0,InpKPeriod,InpDPeriod,InpSlowing,MODE_SMA,0,0,0);
SignalCCIPrevious=iCCI(NULL,0,InpCCIPeriod,0,1);
SignalCCIThis=iCCI(NULL,0,InpCCIPeriod,0,0);
if(CountTrades()==0) CheckForOpen();
}
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+void CheckForOpen()
{if(ModLots())
{
//-----Ставим ордер на покупку.if(SignalCurrent<MacdCurrent && SignalMAPrevious<SignalMAThis &&
Ask>SignalParabolic && SignalStochastic_5<MainStochastic_5&&SignalStochastic<MainStochastic&&
SignalCCIPrevious<SignalCCIThis)
{
ticket=OrderSend(NULL,OP_BUY,lot,Ask,slippage,0,0,exptime,magic,0,Blue);
if(ticket>0)
return;
}
//-----Ставим ордер на продажу.if(SignalCurrent>MacdCurrent && SignalMAPrevious>SignalMAThis &&
Bid<SignalParabolic && SignalStochastic_5>MainStochastic_5&&SignalStochastic>MainStochastic&&
SignalCCIPrevious>SignalCCIThis)
{
ticket=OrderSend(NULL,OP_SELL,lot,Bid,slippage,0,0,exptime,magic,0,Red);
if(ticket>0)
return;
}
}
}
//+------------------------------------------------------------------+int CountTrades()
{
int count=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==magic)
count++;
}
}
return(count);
}
//+------------------------------------------------------------------+bool ModLots()
{
for(int i=OrdersHistoryTotal()-1;i>=0;i--)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)) continue;
if((OrderMagicNumber()==magic) && (OrderSymbol()==Symbol()))
{
if(OrderProfit()<0)
{lot=OrderLots()*LotMarti; break;}
else { lot=Lots; break;}
}
}
return(true);
}
//+------------------------------------------------------------------+
Hello. The mql4 manual says that Timer and ChartEvent event handling is not supported in the strategy tester. Accordingly, the buttons (OBJ_BUTTON) do not work (more precisely, nothing happens when you click). The trial version of this EA, however, for some reason doesn't support this rule. Please tell me why this is happening and how to make the buttons in the tester work?
Maks_Knyazev: Hello. The mql4 manual says that the Timer and ChartEvent events processing is not supported in the strategy tester. Accordingly, the buttons (OBJ_BUTTON) do not work (more precisely, nothing happens when you click). The trial version of this EA, however, for some reason doesn't support this rule. Please tell me why this is happening and how to make the buttons in the tester work?
Yes, they don't work. You have to check the buttons manually in the tester, like this
Hello. Didn't close the profit on the 09-47 minute candle on EURUSD the profit was at 1.08428 the candle went to 1.08420. What to do? Thanks in advance.
Hello. Didn't close the profit on the 09-47 minute candle on EURUSD the profit was at 1.08428 the candle went to 1.08420. What to do? Thank you in advance.
You should pay attention to the spread, because short positions are closed on Asc, while the candlestick is drawn on Bid. Spreads over 8 pips for a five-digit is normal for most currency pairs.
Hello. Didn't close the profit on the 09-47 minute candle on EURUSD the profit was at 1.08428 the candle went to 1.08420. What to do? Thank you in advance.
Tick quotes to write. Shall I send you my quote? Although there are plenty of them in kodobaz. You were right about the spread.
Hello. The mql4 manual says that the Timer and ChartEvent events processing is not supported in the strategy tester. Accordingly, the buttons (OBJ_BUTTON) do not work (more precisely, nothing happens when you click). The trial version of this EA, however, for some reason doesn't support this rule. Please tell me why this is happening and how to make the buttons in the tester work?
Yes, they don't work. You have to check the buttons manually in the tester, like this
Yes, they don't work. In the tester, you have to check the buttons manually, like this
flint17480, 2016.02.01 08:58
Hello. Didn't close the profit on the 09-47 minute candle on EURUSD the profit was at 1.08428 the candle went to 1.08420. What to do? Thanks in advance.flint17480, 2016.02.01 08:58
Hello. My profit on EURUSD was at 1.08428 and went up to 1.08420. Can you tell me what to do? Thanks in advance.Need more information:
flint17480, 2016.02.01 08:58
Hello. Didn't close the profit on the 09-47 minute candle on EURUSD the profit was at 1.08428 the candle went to 1.08420. What to do? Thank you in advance.You should pay attention to the spread, because short positions are closed on Asc, while the candlestick is drawn on Bid. Spreads over 8 pips for a five-digit is normal for most currency pairs.
flint17480, 2016.02.01 08:58
Hello. Didn't close the profit on the 09-47 minute candle on EURUSD the profit was at 1.08428 the candle went to 1.08420. What to do? Thank you in advance.Good afternoon to all) Share the code for a mobile stop loss - to drive the price )))) Thanks in advance.