Experts: Multi Stochastic

 

Multi Stochastic:

A multi-currency Expert Advisor based on the iStochastic (Stochastic Oscillator) indicator signals.

Multi Stochastic tester

Author: Vladimir Karputov

 
Automated-Trading:

Multi Stochastic:

Author: Vladimir Karputov

Vladimir, please make a switchable Martin class, because I have to manually add it to all codes to check if it works....

Thanks

//--- external
input double   KLot      =5;         // Lot multiplication factor
input double   MaxLot    = 0.20;         // Maximum lot, after which the lot is initialised
input double   Lots       = 0.040;       // Number of lots for trading 

//+------------------------------------------------------------------+ 
//| Apply Martin or reject, set KLot=1 ||
//+------------------------------------------------------------------+
double martin(void)
  {
   double lot=Lots;
//--- Access history
   HistorySelect(0,TimeCurrent());
//--- Deals in history
   int orders=HistoryDealsTotal();
//--- Ticket of the last transaction 
   ulong ticket=HistoryDealGetTicket(orders-1);
   if(ticket==0)
     {
      Print("No deals in history! ");
      lot=Lots;
     }
//--- Profit of the transaction
   double profit=HistoryDealGetDouble(ticket,DEAL_PROFIT);
//--- Transaction Lot.
   double lastlot=HistoryDealGetDouble(ticket,DEAL_VOLUME);
//--- Profit negative
   if(profit<0.0)
     {
      //--- Increase the next lot
      lot=lastlot*KLot;
      Print(" The deal is closed at the stop! ");
     }
//--- Bring the lot to a minimum
   double minvol=SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
   if(lot<minvol)
      lot=minvol;
//--- If the lot is larger than the maximum lot, then the initial lot
   if(lot>MaxLot)
      lot=Lots;
//--- Return trade volume
   return(lot);
  }
//+------------------------------------------------------------------+
//| See the type of the last closed transaction |
//+------------------------------------------------------------------+
int LastDealType(void)
  {
   int type=0;
//--- Access history
   HistorySelect(0,TimeCurrent());
//--- Deals in history
   int orders=HistoryDealsTotal();
//--- Ticket of the last transaction 
   ulong ticket=HistoryDealGetTicket(orders-1);
//--- No transactions in history
   if(ticket==0)
     {
      Print("No deals in history! ");
      type=0;
     }
   if(ticket>0)
     {
      //--- Last BUY trade 
      if(HistoryDealGetInteger(ticket,DEAL_TYPE)==DEAL_TYPE_BUY)
        {
         type=2;
        }
      //--- Last trade SELL
      if(HistoryDealGetInteger(ticket,DEAL_TYPE)==DEAL_TYPE_SELL)
        {
         type=1;
        }
     }
//---
   return(type);
  }  
//+------------------------------------------------------------------+
 
Сергей Криушин:

Vladimir, please make a switchable Martin class, otherwise I have to manually add to all codes to check the acceptability in work...

Thanks


Why? There is no need in it.

 
Vladimir Karputov:

Why? It's not necessary.

I don't know...Martin is sometimes much better....

 
Сергей Криушин:

I don't know...sometimes it's much better with Martin.....

It's always better with Martin, but it's not as good without Martin.

 
Vitaly Muzichenko:

It always works much better with martin, but without it everything is sad.

Yes, the main thing is not to accelerate it, so as not to drain...by the way, the universal code is taken from https://www.mql5.com/en/code/13315 if the profit is changed to positive - put profit>0; it will turn out quite an antiMartin...will multiply the profit.... ))
 

Hi

Do you use 2 or 3 stochastic oscillator for trade?

for example- stoch(5,3,3) and stoch(26,10,10) together ?

 
tesla351 :

Hi

Do you use 2 or 3 stochastic oscillator for trade?

for example- stoch(5,3,3) and stoch(26,10,10) together ?


No. Usually one indicator iStochastic (Stochastic Oscillator)  is used.

 

"Tester stopped because OnInit returns non-zero code 1"

How to solve it?