ZeroCode Sample: Create "10-Minute" Strategy Expert
  #1 (permalink)  
Old 08-08-2005, 04:10 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,922
Thanks: 97
Thanked 361 Times in 147 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 ZeroCode Sample: Create "10-Minute" Strategy Expert

Hello there,

This is a tutorial to create "10-Minute" strategy expert advisor for MetaTrader 3.x. I write this for ZeroCode educational purpose only.

Since MT terminal doesn't have 10 minutes timeframe, I'm going to double the indicators parameter to make the expert works in 5 minutes timeframe instead.

Setup Indicators in Order:
  1. WMA 10
  2. SMA 20
  3. Stoch 10 6 6
  4. RSI 28
  5. MACD 24 52 18


Logics:



Compile:

Stop Loss = 25

This is it... Enjoys the simple the 10-minute
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
The Following 2 Users Say Thank You to scorpion For This Useful Post:
  #2 (permalink)  
Old 08-08-2005, 04:13 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,922
Thanks: 97
Thanked 361 Times in 147 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

Compare yours with mine:

PHP Code:
//*------------------------------------------------------------------------------------------------------------------*\
  // This MQL is automatically generated by FXFisherman ZeroCode v1.0.2041.38510 (www.fxfisherman.com)
  //
  // FXFisherman ZeroCode is provided free of charge, and, therefore, on an "as is" basis, without warranty of any kind. 
  // In any case, the authors will not be responsible or liable for ANY LOSSES caused by using of this software.
  //
  //*--------------------------------------------PLEASE DO NOT REMOVE THIS HEADER--------------------------------------*/
  
  /*[[
      Name := 10 minutes
      Author := TradeCurrency.ca, Scorpion
      Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com
      Lots := 1
      Stop Loss := 25
      Take Profit := 60
      Trailing Stop := 0
  ]]*/
  
definesSlippage(3);
  
defines: ;
  var: 
cnt(0),IsBuying(False),IsSelling(False),IsClosing(False),RealTP(0),RealSL(0);
 var: 
macd5sig_1(0),macd5his_0(0),macd5sig_0(0),macd5his_1(0),rsi4_1(0),rsi4_0(0),stoc3d_1(0),stoc3d_0(0),stoc3k_1(0),stoc3k_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
  
macd5sig_1 iMACDEx(24,52,18,PRICE_CLOSE,MODE_SIGNAL,1);
  
macd5his_0 iMACDEx(24,52,18,PRICE_CLOSE,MODE_MAIN,0);
  
macd5sig_0 iMACDEx(24,52,18,PRICE_CLOSE,MODE_SIGNAL,0);
  
macd5his_1 iMACDEx(24,52,18,PRICE_CLOSE,MODE_MAIN,1);
  
rsi4_1 iRSI(28,1);
  
rsi4_0 iRSI(28,0);
  
stoc3d_1 iSTO(10,6,6,MODE_SMA,MODE_SIGNAL,1);
  
stoc3d_0 iSTO(10,6,6,MODE_SMA,MODE_SIGNAL,0);
  
stoc3k_1 iSTO(10,6,6,MODE_SMA,MODE_MAIN,1);
  
stoc3k_0 iSTO(10,6,6,MODE_SMA,MODE_MAIN,0);
  
ma1_1 iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,1);
  
ma1_0 iMAEx(10,MODE_LWMA,0,PRICE_CLOSE,0);
  
ma2_1 iMAEx(20,MODE_SMA,0,PRICE_CLOSE,1);
  
ma2_0 iMAEx(20,MODE_SMA,0,PRICE_CLOSE,0);
  
  
  
// Check for BUY, SELL, and CLOSE signal
  
IsBuying = (ma1_0 ma2_0)
   and (
stoc3k_0 stoc3d_0)
   and (
rsi4_0 50)
   and (
macd5his_0 0);
  
IsSelling = (ma1_0 ma2_0)
   and (
stoc3k_0 stoc3d_0)
   and (
rsi4_0 50)
   and (
macd5his_0 0);
  
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("10 minutes: Closing BUY order.");
              };
           
           
// Check trailing stop
           
If TrailingStop>0 then
             
{                   
              If (
Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStopthen
                
{
                 If 
OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStopthen
                      
{
                       
// 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("10 minutes: Closing SELL order.");
              };
           
           
// Control trailing stop
           
If TrailingStop>0 then
              
{
              If (
OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStopthen
                
{
                 If 
OrderValue(cnt,VAL_STOPLOSS)=or 
                    
OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingStopthen
                      
{
                    
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,AskSlippage,RealSL,RealTP,RED);
        
Alert("10 minutes: 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("10 minutes: Selling");
       };
    };
    
    
  
//-------------- Coded by FXFisherman ZeroCode v1.0.2041.38510 
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.

Last edited by scorpion : 11-04-2005 at 11:51 AM.
Reply With Quote
The following users have thanked scorpion for useful post above:
  #3 (permalink)  
Old 08-08-2005, 05:42 AM
gazuz's Avatar
Senior Trader and Moderat
 
Join Date: Aug 2004
Posts: 768
Thanks: 1
Thanked 8 Times in 5 Posts
gazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to allgazuz is a name known to all
Default

Just something to add before I go to sleep I think i remember reading that the system has to be run only at certain hours, we'll need the final version of zerocode in order to make it possible for this system to work at its fullest.. Also we'll need some optimizing to make it work in either 5 minute or 15 minute since there is no 10 minute chart on metatrader but rather VTTrader
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
¦_____¦_____¦_____¦_____¦_____¦_____¦__
Reply With Quote
  #4 (permalink)  
Old 01-05-2006, 08:48 PM
Sophomore
 
Join Date: Jan 2006
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
zztop is on a distinguished road
Default

hi mate I play it for some times mt 15 min what ever the indi is in 5 min time dif by 1/2 you get 10 mmin dif by 1/2 again +/- you have 15 min but the wip is the problem
Reply With Quote
BUY/SELL automatic execution in MQ4
  #5 (permalink)  
Old 07-02-2006, 08:56 PM
Freshman
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
tarantulafx is on a distinguished road
Default BUY/SELL automatic execution in MQ4

Hi, I would like to know in MQ4 how to automatically execute BUY/SELL and CLOSE of position using CCI (14) with S/L of (say) 20. The BUY execution will only start when the tick leaves 0 towards positive value and curved back to 0 value of CCI to close BUY position. SELL execution will begin when the tick leaves 0 value down to negative value and curved back to 0 value to close position. The parameter applied to HCL/3.

Thank you.
Reply With Quote
  #6 (permalink)  
Old 08-19-2006, 01:46 AM
Freshman
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
mpotero is on a distinguished road
Default

Hi,
I am Mauro, new around here. I saw your ZeroCode sample and I am interested in trying it.
Thank you,
otero.felix@gmail.com
Reply With Quote
  #7 (permalink)  
Old 08-19-2006, 09:26 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,922
Thanks: 97
Thanked 361 Times in 147 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

Hi Mauro

You can download ZeroCode for MT3 from http://www.fxfisherman.com/site/inde...p13_fileid =3
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #8 (permalink)  
Old 08-21-2006, 03:48 PM
fxloco's Avatar
Freshman
 
Join Date: Jun 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
fxloco is on a distinguished road
Default

Hi there, I am newbie with MT4 platform. How to edit indicator with ex4?
Thanks
Reply With Quote
  #9 (permalink)  
Old 08-21-2006, 04:08 PM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,922
Thanks: 97
Thanked 361 Times in 147 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

Hi there

Version for MT4 is in design stage, so i guess it will take some weeks to get final. Stay tuned for all exciting features in the upcoming weeks!
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #10 (permalink)  
Old 08-22-2006, 01:09 AM
Freshman
 
Join Date: Jun 2006
Posts: 25
Thanks: 0
Thanked 38 Times in 3 Posts
richx7 is on a distinguished road
Default

Quote:
How to edit indicator with ex4?
EX4s are compiled MQ4s and can't be edited - you can only edit MQ4s that make it. To change parameters you can right click on the indicator and change the properties or right click on the chart and choose indicator.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ZeroCode Expert Running 3 Majors (?) Scicronys MetaTrader and ZeroCode 8 12-12-2007 08:58 AM
Use mouse to create experts for MT3 (ZeroCode) scorpion Tools / Utilities 0 05-06-2006 03:19 AM
ZeroCode expert not working Scicronys MetaTrader and ZeroCode 2 11-13-2005 10:27 AM
Help bulding expert In Zerocode Please motisi2 MetaTrader and ZeroCode 4 07-29-2005 07:06 AM
ZeroCode: Create a simple MACD Cross expert scorpion Tutorials, Tips & Tricks 2 06-08-2005 03:23 PM


All times are GMT. The time now is 10:41 PM.
Powered by vBulletin Version 3.6.2
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