Problem getting the zero code to verify
|
|||
|
I tried to make a simple EA to learn how this new software works. what I was trying to do was to set 3 EMA's on the chart - 34 H/L/C. Buy when the prices closes above the High 34 EMA and sells when price closes below Low 34 EMA (I would be adding some other perimeters at a later date).
It won't verify 10 errors.. I probably did it wrong...but... Here is how the code came out: //*---------------------------------------------------------------------------------------------------------*\ // This MQL is automatically generated by FXFisherman ZeroCode v1.0.1982.33196 (www.fxfisherman.com) // // DISCLAIMER: // // FXFisherman ZeroCode is provided free of charge, and, therefore, on an "as is" basis, without warranty // of any kind, express or implied, including without limitation the warranties that it is free of defects, // virus free, able to operate on an uninterrupted basis, merchantable, fit for a particular purpose or // non-infringing. In any case, the author(s) will not be responsible or liable for ANY SPECIAL, INCIDENTAL, // CONSEQUENTIAL, INDIRECT OR ANY OTHER LOSSES caused by using of this software. USE IT AT YOUR OWN RISK. // //*-----------------------------------PLEASE DO NOT REMOVE THIS HEADER--------------------------------------*/ /*[[ Name := 34 EMA Author := rosst Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com Lots := 1 Stop Loss := 25 Take Profit := 0 Trailing Stop := 25 ]]*/ defines: Slippage(3); defines: ; var: cnt(0),IsBuying(False),IsSelling(False),IsClosing( False),RealTP(0),RealSL(0); var: ma3_1(0),ma3_0(0),ma1_1(0),ma1_0(0),ma2_1(0),ma2_0 (0); // Check for invalid bars and takeprofit If Bars<200 then Exit; // Calculate indicators' value ma3_1 = iMAEx(34,MODE_EMA,0,PRICE_CLOSE,1); ma3_0 = iMAEx(34,MODE_EMA,0,PRICE_CLOSE,0); ma1_1 = iMAEx(34,MODE_EMA,0,PRICE_HIGH,1); ma1_0 = iMAEx(34,MODE_EMA,0,PRICE_HIGH,0); ma2_1 = iMAEx(34,MODE_EMA,0,PRICE_LOW,1); ma2_0 = iMAEx(34,MODE_EMA,0,PRICE_LOW,0); // Check for BUY, SELL, and CLOSE signal IsBuying = (price closes above ema#1 == ); IsSelling = (prices closes below ema#2 == ); IsClosing = False; // Control open trades for cnt=1 to TotalTrades { // Control only market trades not entry order if OrderValue(cnt,VAL_TYPE)<=OP_SELL and OrderValue(cnt,VAL_SYMBOL)=Symbol then { // Check for close signal for bought trade If OrderValue(cnt,VAL_TYPE)=OP_BUY then { If IsSelling or IsClosing then { // Close bought trade CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Bid,3,Violet); Alert("34 EMA: Closing BUY order."); }; // Check trailing stop If TrailingStop>0 then { If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop ) then { If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then { // Modify trailing stop ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE), Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT), Red); }; }; }; } else { // Check sold trade for close signal If IsBuying or IsClosing then { CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Ask,3,Violet); Alert("34 EMA: Closing SELL order."); }; // Control trailing stop If TrailingStop>0 then { If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then { If OrderValue(cnt,VAL_STOPLOSS)=0 or OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingSt op) then { ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE), Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROF IT),Red); }; }; }; }; }; }; // If there is no open trade If TotalTrades<1 then { // If we have enough money for 1 lot If FreeMargin<1000 then Exit; // Check for BUY entry signal If IsBuying and IsSelling=False and IsClosing=False then { // Buy If StopLoss>0 then { RealSL=Ask-StopLoss*Point; } If TakeProfit>0 then { RealTP=Ask+TakeProfit*Point; } SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,RED); Alert("34 EMA: Buying"); }; // Check for SELL entry signal If IsSelling and IsBuying=False and IsClosing=False then { // Sell If StopLoss>0 then { RealSL=Bid+StopLoss*Point; } If TakeProfit>0 then { RealTP=Bid-TakeProfit*Point; } SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,R ED); Alert("34 EMA: Selling"); }; }; //-------------- Coded by FXFisherman ZeroCode v1.0.1982.33196 |
![]() |
|
||||
|
Quote:
|
Yes you are correct!
|
|||
|
Quote:
ZeroCode Beta 2 Status Video Walkthrough: Create a simple MACD Cross expert MQL Code Maker Important: ZeroCode Final Release Custom Indicators Something is not good in this code Important: ZeroCode Header in Compiled MQL files Go to first new post I only want to trade on close TRading Idea Closing Pending Orders Small lot sizes, MT4 Thanks for your patience and understanding for someone struggling to understand, and please excuse my ignorance. Thanks Ross |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Custom Code request : Action breakeven stop Automatic | Digs | Trading Systems | 0 | 09-24-2006 06:43 AM |
| Systems created with Zero Code beta 1 | Belzebut | MetaTrader and ZeroCode | 19 | 07-19-2005 07:34 AM |
| Zero code beta 2 suggestions | Belzebut | MetaTrader and ZeroCode | 0 | 06-12-2005 09:40 AM |
| Something is not good in this code | alp | MetaTrader and ZeroCode | 3 | 06-09-2005 09:10 AM |
| MQL Code Maker | scorpion | MetaTrader and ZeroCode | 42 | 06-07-2005 03:27 PM |
All times are GMT. The time now is 03:14 AM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now












Linear Mode

