ZeroCode Expert Running 3 Majors (?)
  #1 (permalink)  
Old 11-08-2005, 10:48 AM
Freshman
 
Join Date: Nov 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Scicronys is on a distinguished road
Arrow ZeroCode Expert Running 3 Majors (?)

I have successfully created an expert using ZeroCode. Unfortunately, it seems my expert can only be used on one currency pair at a time. I would like to use my expert on three pairs simultaneously. I have read this thread and I don't think MetaTrader's 5 sec rule will be applicable in my case based on the longer-term nature of my trades which is obviously a good thing. Here is the code of the simple MA Cross system I have developed. If anyone can add in a function (TotalTrades(?)...) to allow me to attach the same advisor to three currency pairs I would REALLY appreciate it. Thank You

Code:
//*---------------------------------------------------------------------------------------------------------*\ // This MQL is automatically generated by FXFisherman ZeroCode v1.0.2014.30845 (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 := ZeroCode Test System Author := ZeroCoder Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com Lots := 1 Stop Loss := 40 Take Profit := 0 Trailing Stop := 0 ]]*/ defines: Slippage(3); defines: ; var: cnt(0),IsBuying(False),IsSelling(False),IsClosing( False),RealTP(0),RealSL(0); var: 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 ma1_1 = iMAEx(2,MODE_EMA,0,PRICE_CLOSE,1); ma1_0 = iMAEx(2,MODE_EMA,0,PRICE_CLOSE,0); ma2_1 = iMAEx(20,MODE_EMA,0,PRICE_CLOSE,1); ma2_0 = iMAEx(20,MODE_EMA,0,PRICE_CLOSE,0); // Check for BUY, SELL, and CLOSE signal IsBuying = (ma1_1 < ma2_1) and (ma2_0 > ma2_0); IsSelling = (ma1_1 > ma2_1) and (ma1_0 < ma2_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(c nt,VAL_LOTS),Bid,3,Violet); Alert("ZeroCode Test System: 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("ZeroCode Test System: 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 { 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("ZeroCode Test System: 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("ZeroCode Test System: Selling"); }; }; //-------------- Coded by FXFisherman ZeroCode v1.0\

Reply With Quote
  #2 (permalink)  
Old 11-09-2005, 02:58 AM
gazuz's Avatar
Forex Honorary Moderator
 
Join Date: Aug 2004
Posts: 769
Thanks: 2
Thanked 9 Times in 6 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

Im not an expert on this but I'm thinking that the best way to do this is by just opening three different metatrader platforms and I think you should be allowed to login to the same account for both.
__________________
____________________________\¦/
___________________________(ò ó)
______________________o0o___(_)___o0o__
___¦_____¦_____¦_____¦_____¦_____¦_____¦
Reply With Quote
thanks gazuz
  #3 (permalink)  
Old 11-09-2005, 07:28 AM
Freshman
 
Join Date: Nov 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Scicronys is on a distinguished road
Thumbs up thanks gazuz

gazuz thank you so much for the reply.

I will try this and report back...
Reply With Quote
  #4 (permalink)  
Old 11-10-2005, 04:36 AM
Freshman
 
Join Date: Nov 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Scicronys is on a distinguished road
Default

gazuz, unfortunately this did not seem to work. I was able to log into multiple platforms with the same account just not able to utilize my advisor as described above. It still executed trades on just one currency pair. Again, thank you very much for your kind suggestion. If anyone, including gazuz, knows if there is anything else I should try please do not hesitate to let me know
Reply With Quote
  #5 (permalink)  
Old 11-11-2005, 04:58 PM
scorpion's Avatar
Forex Guru
 
Join Date: Aug 2004
Posts: 2,120
Thanks: 214
Thanked 387 Times in 155 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
Default

In my opinion, metatrader 3 platform doesn't handle multiple positions in one account well, although the mql programming is not limited to open multiple positions. In demo account, it might be just fine, but in real cash account, it's a different ball game--most mt brokers must have all trade executions confirmed manually, so what if an order is refused but the return code is "ok, it's closed".

However, if you just want to test your expert on various currency pairs, then:

1. Duplicate MetaTrader folder.
2. Run the metatrader program in the new folder.
3. Open new demo account.
4. Run your expert in the currency pair your like.
5. Repeat the step 1-4 if you need to test on another pair.

Hope this helps you.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #6 (permalink)  
Old 11-13-2005, 11:42 AM
Freshman
 
Join Date: Nov 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Scicronys is on a distinguished road
Default

Scorpion thanks for your reply. MT doesn't seem to handle much very well. How does the supposed 1.9 trillion dollar a day currency market not produce a workable platform that can be programmed to execute trades automatically? It doesn't make sense. 1.9 trillion dollars adds up, doesn't it? LOL Clearly it's a broker's game. I talked to one of my preferred brokers over the phone and asked if MT was a reliable source of automatic trading - they replied 'yes - it should be', hahaha I agree. Unless ZeroCode (no offence) simply does not produce enough code to handle all of the variables needed to sustain an MA Cross stop & reverse strategy then MT is simply not an option for me. Paying for an API is also unfortunately not an option at this time. Thoughts?
Reply With Quote
  #7 (permalink)  
Old 11-13-2005, 01:26 PM
scorpion's Avatar
Forex Guru
 
Join Date: Aug 2004
Posts: 2,120
Thanks: 214
Thanked 387 Times in 155 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
Default

Of course trading platforms for small traders are just like gaming platform. Because, we speculators all together is only a tiny bit in 1.9 trillion dollar a day. We most of the time play against each others within the same broker only. I guess 99.9% of 1.9 trillion exchange is traded by instituion directly with banks and banks with banks. BoJ alone regularly exchange trillions dollar worth of USDJPY in just a few weeks! And Top 100 fortune companies alone exchange trillions dollar worth directly with banks. I don't think they trade with brokers who charge them 2-3 pips spread! In brief, platform we use today either FXCM tradestation, Oanda FXTrade, or MetaTrader can be categorized as a gaming software--some people even name it gambling software!

Anyway, MetaTrader 4 is kinda reliable for multiple-position execution, coz it natively supports magic number. MQL4 can assign magic number accordingly to each trade on server and then can close them reliably. Auto trading in MT3 is absolutely not reliable.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.

Last edited by scorpion : 11-13-2005 at 01:30 PM.
Reply With Quote
  #8 (permalink)  
Old 11-14-2005, 12:12 PM
Freshman
 
Join Date: Nov 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Scicronys is on a distinguished road
Thumbs up

Scorpion I knew I could count on you to put my arrogant attitude in its place! What you say makes a lot of sense. It still seems though that the average trader should at least have a fighting chance when it comes to autotrading. Clearly MT3 isn't reliable in this sense but perhaps I wrote off MT4 too quickly. I had read numerous reports on various forums about all the bugs which needed to be fixed in version 4 and was put off quite quickly. However, after taking your advice things seem to be working quite well. In fact I have no complaints whatsoever. Hopefully MT4 is the answer. Thanks again for your insight Scorpion - it's always welcomed.
Reply With Quote
  #9 (permalink)  
Old 12-12-2007, 09:58 AM
Freshman
 
Join Date: Sep 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
tukul love 4x is on a distinguished road
Default

Hello,
Mr Scicronys we have Ea That called EURO fx2 This is Profitable but This Direction So dengerous...Because of To depend their open order their go everywhere until back again to order and go closing.Coul you repair it so that this EA best in direction and this EA Closing to new direction and This EA don't have floating openposion in long term???Could u help to makee this EA stable and usefull.Thx so much

Indonesian Trader that called tukul love 4x....
He..he..he...
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 Sample: Create "10-Minute" Strategy Expert scorpion Tutorials, Tips & Tricks 16 04-13-2008 11:29 PM
ZeroCode expert not working Scicronys MetaTrader and ZeroCode 2 11-13-2005 11:27 AM
Help bulding expert In Zerocode Please motisi2 MetaTrader and ZeroCode 4 07-29-2005 07:06 AM
Important: ZeroCode Header in Compiled MQL files scorpion MetaTrader and ZeroCode 0 06-09-2005 08:59 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:49 AM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2010, 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