Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 90

 
artmedia70:

Haven't looked for errors yet - lots to do.

To close Sell where the red cross is, you need to check on the current bar. If Ask<= close level && Open[0]>close level


Something does not work at all A Sell deal with the code if(Ask<=PriceLow && Open[0]>PriceLow) OrderClose(OrderTicket(),OrderLots(),Ask,3,White); does not close at all.


If interested in the topic for an expedited contact me skype alexey1979621

 
alexey1979621:

Something does not work OrderClose(OrderTicket(),OrderLots(),Ask,3,White); does not close if(Ask<=PriceLow && Open[0]>PriceLow); does not close at all.


If interested in the topic for fast communication with me skype alexey1979621


 if(Ask<=PriceLow && High[1]>PriceLow) OrderClose(OrderTicket(),OrderLots(),Ask,3,White);
 
artmedia70:


It didn't work. Maybe this thing if(Volume[0]>1) returns;
 
alexey1979621:

Testing at opening prices?

It's all about the ticks

 
testing on all ticks
artmedia70:

Testing at opening prices?

It's all about the ticks


testing on all ticks
 
alexey1979621:
testing on all ticks testing on all ticks

And where was the indicator line at the time of the Sell close ?

 
alexey1979621:

Corrected, closed the trade the same way as in the screenshot above, but I need to close where the red cross is.

I agree that ExtremeTMA is overdrawing, but I guess it doesn't affect the search for entry points, the main thing here is the filters. I used TDI indicator. I attached attached what I made (I don't have good hands, that's why this EA should be handled properly). I have only one problem with it, it takes about 5 hours in tester for 1 year (I have made one mistake somewhere). If it is not difficult to check for errors.

Try to open orders in the following way:

int CalculateCurrentOrders(string symbol)
  {
   int buys=0,sells=0;
   //----
   if (OrdersTotal()>0)
   {  for (int i=OrdersTotal()-1; i>=0; i--)
      {  if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         {  if (OrderSymbol()!=Symbol())   continue;
            if (OrderMagicNumber()!=Magic) continue;
            {  if(OrderType()==OP_BUY)  buys++;
               if(OrderType()==OP_SELL) sells++;
            }
   }  }  }
   //---- return orders volume
   if(buys>0) return(buys);
   else       return(-sells);
  }

It caught my eye that you set Magic=124, but the code immediately says 124. Same with Slippage, OrderSend and OrderClose have 3 (three).

 
alexey1979621:

Corrected, closed the trade the same way as in the above screenshot, but the red cross should be there.

I agree that ExtremeTMA is overdrawing, but I guess it doesn't affect the search for entry points, the main thing here is the filters. I used TDI indicator. I attached attached what I made (I don't have good hands, that's why the Expert Advisor is a good project). I have only one problem with it, it takes about 5 hours in tester for 1 year (I have made one mistake somewhere). If you don't mind looking for errors.

It is possible that the speed of the EA is falling because of the heaviness of calculations of the custom indicator. If you want to check the difficulty of the calculations, do the following script on the chart you trade on. If there is no comment for a long time then decrease N to 100000 or even less. See how many milliseconds it takes per iteration.

//---
int    N=1000000;
//---
double PriceHigh, PriceLow, TDIHigh, TDILow, RSIPriceLine, TradeSignalLine;
int    timestart, timestop;
//---
string TimeFrame         = "current time frame";
int    HalfLength        = 56;
int    Price             = PRICE_CLOSE;
double ATRMultiplier     = 2.0;
int    ATRPeriod         = 100;
bool   Interpolate       = true;
double TrendThreshold    = 0.5;
bool   Distances         = false;
//---
int RSI_Period           = 13;         //8-25
int RSI_Price            = MODE_CLOSE;           //0-6
int Volatility_Band      = 34;    //20-40
int RSI_Price_Line       = 2;      
int RSI_Price_Type       = MODE_SMA;      //0-3
int Trade_Signal_Line    = 7;   
int Trade_Signal_Type    = MODE_SMA;   //0-3
bool UseAlerts           = false;
//===============================================
int start()
{
   timestart=GetTickCount();
   for (int i=0;i<N;i++) 
   {  
   PriceHigh = iCustom (Symbol(), 0, "ExtremeTMALine", TimeFrame, HalfLength , Price, 
                        ATRMultiplier, ATRPeriod, Interpolate, TrendThreshold, Distances, 1, 0);
   PriceLow = iCustom (Symbol(), 0, "ExtremeTMALine", TimeFrame, HalfLength , Price, 
                       ATRMultiplier, ATRPeriod, Interpolate, TrendThreshold, Distances, 2, 0);
   TDIHigh = iCustom (Symbol(), 0, "TradersDynamicIndex", RSI_Period, RSI_Price, Volatility_Band, 
                      RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type, UseAlerts, 1, 0);
   TDILow = iCustom (Symbol(), 0, "TradersDynamicIndex", RSI_Period, RSI_Price, Volatility_Band, 
                     RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type,UseAlerts, 3, 0);
   RSIPriceLine = iCustom (Symbol(), 0, "TradersDynamicIndex", RSI_Period, RSI_Price, Volatility_Band, 
                           RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type,UseAlerts, 4, 0);
   TradeSignalLine = iCustom (Symbol(), 0, "TradersDynamicIndex", RSI_Period, RSI_Price, Volatility_Band, 
                              RSI_Price_Line, RSI_Price_Type, Trade_Signal_Line, Trade_Signal_Type,UseAlerts, 5, 0);
   }
   timestop=GetTickCount();
   //---
   Comment(" Calculation ",N," times was =  ",timestop-timestart," millisec \n",
           " One iteration was = ",(timestop-timestart)/(N-1)," millisec");
   return(0);
}
//---
Files:
testing_1.zip  4 kb
 
artmedia70:

And where was the indicator line at the close of the Sell ?

Everything is as it is on the screenshot. The channel did not have time to redraw.
 
paladin80, your script shut down my computer twice!