- Need help with coding EA to work with my broker
- Need help
- there are no trading operations
-
Help you with what? You haven't stated a problem, you haven't even stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
No free help 2017.04.21 -
“Doesn't work” is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
How To Ask Questions The Smart Way. 2004
When asking about codeDo you really expect an answer? There are no mind readers here and our crystal balls are cracked. Always post all relevant code.
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problemWe can't see your broken code.
Fix your broken code.
With the information you've provided — we can only guess. And you haven't provided any useful information for that.
How can we know what it's doing and what you want it to do?
#property copyright "JimWest" #property link "https://www.mql5.com" #property version "1.00" #property strict //IDEA: EA basato su ARRAY..MAV&MAL..RSI extern int MagicNumber = 333 ; extern int StopLoss= 50 ; extern int TakeProfit= 50 ; extern double Lotti= 1 ; double p; extern int RangeBarre= 6 ; double HighTotBarre= 0.0 ; double LowTotBarre= 0.0 ; extern int PeriodoMaV= 20 ; extern int PeriodoMaL= 100 ; double MaV,MaL; extern int RSI= 50 ; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit () { p= Point ; if ( Point == 0.00001 ) p= 0.0001 ; if ( Point == 0.001 ) p= 0.01 ; return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick () { MaV= iMA ( Symbol (), PERIOD_CURRENT ,PeriodoMaV, 0 , 0 , PRICE_CLOSE , 0 ); MaL= iMA ( Symbol (), PERIOD_CURRENT ,PeriodoMaL, 0 , 0 , PRICE_CLOSE , 0 ); if (OrdiniAperti()== false &&OrdiniApertiMaChiusiSuBarra()== false ){ for ( int i= 2 ; i<= RangeBarre+ 1 ; i++){ if (HighTotBarre<High[i]) HighTotBarre= High[i]; if (LowTotBarre== 0 ||LowTotBarre>Low[i]) LowTotBarre=Low[i]; } if (High[ 1 ]>HighTotBarre &&Low[ 1 ]>Low[ 2 ]&& Close[ 1 ]>MaL&& MaV>MaL&& Bid<=Open[ 0 ]){ int ticket; ticket= OrderSend ( Symbol (),OP_BUY,Lotti,Ask, 0 ,Bid-StopLoss*p,Bid+TakeProfit*p, "DAJE" ,MagicNumber, 0 ,Blue); } if (Low[ 1 ]<LowTotBarre &&High[ 1 ]<High[ 2 ]&& Close[ 1 ]<MaL&& MaV<MaL&& Bid>= Open[ 0 ]){ int ticket; ticket= OrderSend ( Symbol (),OP_SELL,Lotti,Bid, 0 ,Ask+StopLoss*p,Ask-TakeProfit*p, "DAJE" ,MagicNumber, 0 ,Red); } } } //+-------------BOOL-----------------------------------------------------+ bool OrdiniAperti() { for ( int i= OrdersTotal ()- 1 ; i>= 0 ;i--){ if ( ! OrderSelect (i,SELECT_BY_POS,MODE_TRADES)) continue ; if (OrderSymbol()== Symbol ()&& OrderMagicNumber()==MagicNumber){ return ( true ); } } return ( false ); } bool OrdiniApertiMaChiusiSuBarra() { for ( int i= OrdersHistoryTotal()- 1 ; i>= 0 ;i--){ if ( ! OrderSelect (i,SELECT_BY_POS,MODE_HISTORY)) continue ; if (OrderSymbol()== Symbol ()&& OrderMagicNumber()==MagicNumber&& OrderOpenTime()>=Time[ 0 ]){ return ( true ); } } return ( false ); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { //--- } // Sometimes error 4107
-
ticket= OrderSend ( Symbol (),OP_BUY,Lotti,Ask, 0 ,Bid-StopLoss*p,Bid+TakeProfit*p, "DAJE" ,MagicNumber, 0 ,Blue);
Check your return codes, and report your errors (including market prices and your variables). Don't look at GLE/LE unless you have an error. Don't just silence the compiler (strict), it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum 2012.05.20
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles 25 March 2014 -
for ( int i= 2 ; i<= RangeBarre+ 1 ; i++){ if (HighTotBarre<High[i]) HighTotBarre= High[i]; if (LowTotBarre== 0 ||LowTotBarre>Low[i]) LowTotBarre=Low[i]; }
You never reset your variables so code breaks on the next new candle. Why roll your own instead of using iHighest?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use