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
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.
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
- www.mql5.com
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.
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 Переводчик не помогает. Я не понимаю ни одного Вашего слова.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
E-Skoch-Open:
Author: Vladimir Karputov