Experts: E-Skoch-Open

 

E-Skoch-Open:

Opens a SELL position on each bar, if Close of the 1st bar > Close of the 3rd bar. Opens a BUY position on each bar, if Close of the 3rd bar > Close of the 1st bar.

Author: Vladimir Karputov

 
Automated-Trading:

E-Skoch-Open:

Author: Vladimir Karputov

how to test? i have error about hedging in USD/EUR


2018.05.12 21:13:01.827 Core 1 1971.05.26 00:00:00 Hedging only!

2018.05.12 21:13:01.827 Core 1 tester stopped because OnInit failed


 
alexandre gonçalves :

how to test? i have error about hedging in USD/EUR


2018.05.12 21:13:01.827 Core 1 1971.05.26 00:00:00 Hedging only!

2018.05.12 21:13:01.827 Core 1 tester stopped because OnInit failed


This advisor can only work on trading accounts with a hedge accounting system positions.

 
alexandre gonçalves:

how to test? i have error about hedging in USD/EUR


2018.05.12 21:13:01.827 Core 1 1971.05.26 00:00:00 Hedging only!

2018.05.12 21:13:01.827 Core 1 tester stopped because OnInit failed


note that at startup it validates whether your account type is hedged, otherwise it returns an initialisation error.

You can remove this piece of code, but it goes against the author's idea. Or open a hedging account, when you open it you should tick this option, all new accounts are born as neting by default.

the section that validates your account is:

int OnInit()
  {
   SetMarginMode();
   if(!IsHedging())
     {
      Print("Hedging only!");
      return(INIT_FAILED);
     }
   ...
  }


references:

https://www.mql5.com/en/docs/constants/environment_state/accountinformation

https://www.mql5.com/pt/forum/91033


Attn,

Jonathan Pereira

Documentação sobre MQL5: Constantes Padrão, Enumeradores e Estruturas / Estado de Ambiente / Propriedades da Conta
Documentação sobre MQL5: Constantes Padrão, Enumeradores e Estruturas / Estado de Ambiente / Propriedades da Conta
  • www.mql5.com
Para obter informações sobre a conta atual existem várias funções: AccountInfoInteger(), AccountInfoDouble() e AccountInfoString(). Os valores dos parâmetros destas funções podem aceitar valores das enumerações de ENUM_ACCOUNT_INFO. Nível de chamada de margem. Dependendo da definição, ACCOUNT_MARGIN_SO_MODE é expresso em percentagem ou em...
 
sergiomt :

Where did you get the number "1.6"? There is no such parameter.

 

Code

 //+------------------------------------------------------------------+ 
 //| TradeTransaction function| 
 //+------------------------------------------------------------------+ 
 void OnTradeTransaction ( const MqlTradeTransaction &trans,
                         const MqlTradeRequest &request,
                         const MqlTradeResult &result)
  {
 //--- get transaction type as enumeration value  
   ENUM_TRADE_TRANSACTION_TYPE type=trans.type;
 //--- if transaction is result of addition of the transaction in history 
   if (type== TRADE_TRANSACTION_DEAL_ADD )
     {
       long      deal_entry        = 0 ;
       double    deal_profit       = 0.0 ;
       string    deal_symbol       = "" ;
       long      deal_magic        = 0 ;
       if ( HistoryDealSelect (trans.deal))
        {
         deal_entry= HistoryDealGetInteger (trans.deal, DEAL_ENTRY );
         deal_profit= HistoryDealGetDouble (trans.deal, DEAL_PROFIT );
         deal_symbol= HistoryDealGetString (trans.deal, DEAL_SYMBOL );
         deal_magic= HistoryDealGetInteger (trans.deal, DEAL_MAGIC );
        }
       else 
         return ;
       if (deal_symbol== Symbol () && deal_magic==m_magic)
         if (deal_entry== DEAL_ENTRY_OUT )
           {
             if (deal_profit> 0 )
               lot_last=InpLot;
             else 
              {
               lot_last=InpLot* 1.6 ;
               lot_last=LotCheck(lot_last);
              }
           }
     }
  }

means:

If we take an OUT (Out of the Market) transaction and the profit from a transaction is negative, we increase the "объем" by 1.6.

 
sergiomt:

Confirming,

Buy => bar 3 close > bar 2 close and bar 2 close > bar 1 close

Sell => bar close 3 < bar close 2 and bar close 2 < bar close 1


Bar 1 is the current one, bar 2 is the previous one, and bar 3 is the one before bar 2


Is that correct? Thank you

Извините, я не понимаю. Даже Goole Переводчик не помогает. Я не понимаю ни одного Вашего слова.