Thread: MQL Code Maker
View Single Post
Almost...
  #5 (permalink)  
Old 05-31-2005, 10:41 AM
scorpion's Avatar
scorpion scorpion is offline
Administrator
 
Join Date: Aug 2004
Posts: 1,957
Thanks: 112
Thanked 372 Times in 149 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default Almost...

Hey,
Good news! ZeroCode is almost finished. Only graphical user interface is left to code.

Below is a sample MACD crossover system generated by ZeroCode for the first time! I can tell you that below code looks so tidy. In the future, we can expect ZeroCode to be an error-free software that help all traders especially non-programmers to put simple-complex idea into code in just 2 minutes!

If you have some time, live test this expert.

Code:
//*---------------------------------------------------------------------------------------------------------*\ // This MQL is automatically generated by FXFisherman ZeroCode v1.0.1978.27476 (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 := MACD Cross Author := Scorpion Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com Lots := 1 Stop Loss := 0 Take Profit := 0 Trailing Stop := 30 ]]*/ defines: Slippage(3),; var: cnt(0),IsBuying(False),IsSelling(False),IsClosing(False),RealTP(0),RealSL(0); var: macd1signal_1(0),macd1histogram_0(0),macd1signal_0(0),macd1histogram_1(0); // Check for invalid bars and takeprofit If Bars<200 then Exit; // Calculate indicators' value macd1signal_1 = iMACDEx(12,26,9,PRICE_CLOSE,MODE_SIGNAL,1); macd1histogram_0 = iMACDEx(12,26,9,PRICE_CLOSE,MODE_MAIN,0); macd1signal_0 = iMACDEx(12,26,9,PRICE_CLOSE,MODE_SIGNAL,0); macd1histogram_1 = iMACDEx(12,26,9,PRICE_CLOSE,MODE_MAIN,1); // Check for BUY, SELL, and CLOSE signal IsBuying = (macd1histogram_0 > macd1signal_0) and (macd1histogram_1 < macd1signal_1); IsSelling = (macd1histogram_0 < macd1signal_0) and (macd1histogram_1 > macd1signal_1); 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(cnt,VAL_LOTS),Bid,3,Violet); Alert("MACD Cross: 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(cnt,VAL_LOTS),Ask,3,Violet); Alert("MACD Cross: 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*TrailingStop)) then { comment(ask); ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE), Ask+(Point*TrailingStop),OrderValue(cnt,VAL_TAKEPROFIT),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("MACD Cross: 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,RED); Alert("MACD Cross: Selling"); }; }; //-------------- Coded by FXFisherman ZeroCode v1.0.1978.27476
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.

Last edited by scorpion : 06-01-2005 at 10:08 AM.

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now

Main Menu

Economic Forecast