Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1601 (permalink)  
Old 02-17-2009, 05:07 AM
Senior Member
 
Join Date: Oct 2005
Posts: 455
Perky is on a distinguished road
there you go.........................................
Attached Files
File Type: mq4 robtestea.mq4 (6.6 KB, 24 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1602 (permalink)  
Old 02-17-2009, 05:11 AM
Junior Member
 
Join Date: Feb 2009
Location: Perth, Oz
Posts: 19
Couso is on a distinguished road
OK, that was fast! Thanks a lot. What was the problem?

Rob.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1603 (permalink)  
Old 02-18-2009, 02:14 PM
Junior Member
 
Join Date: May 2006
Posts: 6
Dakhr is on a distinguished road
Problem with writing file

I'm programming ea witch uses files to keep results of trade (loss, win) with indicators values .So when EA enters trade i write values of indicators and time ,when trade was made, to file "sellOpenInd.tab":
After this operation file includes:
HTML Code:
CCISDivPresent	22	69	0.000024	0.000046	0.000045	-0.000015	2002.05.07 13:00
CCISDivPresent	66	85	0.000064	0.000032	0.000037	-0.000033	2002.05.15 07:00
CCISDivPresent	77	90	0.000041	-0.000029	0.000008	-0.000020	2002.06.03 08:00
etc...
In next stage i open this file and look into history for dates of opened orders then i check results of this trades and write into file "sellResults.tab"+indicators values writen in previous stage(above) .And here problem occures, only one same trade is recorded:
HTML Code:
Rule7	Rule6	Rule5	Rule4	Rule3	Rule2	Rule1	TradeOutcome
-0.000015	0.000045	0.000046	0.000024	69	22	CCISDivPresent	win
-0.000015	0.000045	0.000046	0.000024	69	22	CCISDivPresent	win
-0.000015	0.000045	0.000046	0.000024	69	22	CCISDivPresent	win
etc..
Here is my code(i know is not looking nice ):
HTML Code:
         int dates=FileOpen("sellOpenInd.tab", FILE_CSV|FILE_READ,"\t");
   if(dates>0){

   for(k=0;k<=10;k++){   //i use for loop instead of while(!FileIsEnding(dates)  ) because ea enters in infinite loop for unknown reasons

 dates=FileOpen("sellOpenInd.tab", FILE_CSV|FILE_READ,"\t");
   FileSeek(dates,filepos,SEEK_SET);
   while (FileIsLineEnding(dates)==FALSE){filestr=FileReadString(dates)+"\t"+filestr;filepos=filepos+FileTell(dates);}
   decodeFile(filestr);//calling function which decodes readed string line, then writing results to global varaiables filter7 ,filter6 etc.
   Comment(filterS7);

   for (i =OrdersHistoryTotal()-1; i>=0; i--) {
   OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
   
                                                 if (OrderSymbol() == Currencies) {
   if((OrderMagicNumber()==16381||OrderMagicNumber()==16383)&&OrderCloseTime()!=0){
   historyDateTime=TimeToStr(OrderOpenTime());
   OrderP=OrderProfit();

   if(OrderP>0)orderresult="win";
      if(OrderP<=0)orderresult="loss";
 
   
   if(filterS7==historyDateTime)    {
   
   testFline=filterS6+"\t"+filterS5+"\t"+filterS4+"\t"+filterS3+"\t"+filterS2+"\t"+filterS1+"\t"+filterS0+"\t"+orderresult;
         
          results=FileOpen("sellResults.tab", FILE_READ|FILE_WRITE,"\t");
          FileSeek(results,0,SEEK_END);
   FileWrite(results,testFline);
      testFline="";
   filestr="";  
                                    }
                                   
                                      
                                                                                   }  
                                                                                   }
 
                                  }
                                    if(!FileIsEnding(dates)){FileClose(dates);FileClose(results);filepos=0;break;
                                                            }
   
   
   }

                                                                                   
                                                                                   
                                               }



Last edited by Dakhr; 02-18-2009 at 06:23 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1604 (permalink)  
Old 02-18-2009, 11:13 PM
Senior Member
 
Join Date: Oct 2008
Location: Vancouver, BC
Posts: 158
Roger09 is on a distinguished road
Every step in your cicle you open file "sellOpenInd.tab" again and again.
Try this:
Code:
       int dates=FileOpen("sellOpenInd.tab", FILE_CSV|FILE_READ,"\t");
   if(dates>0){

   for(k=0;k<=10;k++){   //i use for loop instead of while(!FileIsEnding(dates)  ) because ea enters in infinite loop for unknown reasons

   FileSeek(dates,filepos,SEEK_SET);
   while (FileIsLineEnding(dates)==FALSE){filestr=FileReadString(dates)+"\t"+filestr;filepos=filepos+FileTell(dates);}
   decodeFile(filestr);//calling function which decodes readed string line, then writing results to global varaiables filter7 ,filter6 etc.
   Comment(filterS7);

   for (i =OrdersHistoryTotal()-1; i>=0; i--) {
   OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);
   
                                                 if (OrderSymbol() == Currencies) {
   if((OrderMagicNumber()==16381||OrderMagicNumber()==16383)&&OrderCloseTime()!=0){
   historyDateTime=TimeToStr(OrderOpenTime());
   OrderP=OrderProfit();

   if(OrderP>0)orderresult="win";
      if(OrderP<=0)orderresult="loss";
 
   
   if(filterS7==historyDateTime)    {
   
   testFline=filterS6+"\t"+filterS5+"\t"+filterS4+"\t"+filterS3+"\t"+filterS2+"\t"+filterS1+"\t"+filterS0+"\t"+orderresult;
         
          results=FileOpen("sellResults.tab", FILE_READ|FILE_WRITE,"\t");
          FileSeek(results,0,SEEK_END);
   FileWrite(results,testFline);
      testFline="";
   filestr="";  
                                    }
                                   
                                      
                                                                                   }  
                                                                                   }
 
                                  }
                                    if(!FileIsEnding(dates)){FileClose(dates);FileClose(results);filepos=0;break;
                                                            }
   
   
   }

                                                                                   
                                                                                   
                                               }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1605 (permalink)  
Old 02-19-2009, 08:43 AM
Junior Member
 
Join Date: May 2006
Posts: 6
Dakhr is on a distinguished road
Hi Roger09 i tried this before and it dosn't help .It looks as if pointer isn't moving into next line but i don't know why.
Anyway thanks for reply.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1606 (permalink)  
Old 02-19-2009, 02:42 PM
nck's Avatar
nck nck is offline
Member
 
Join Date: Nov 2008
Posts: 47
nck is on a distinguished road
to coders

would anycoder help me and put mm (risk) into a mq4 file/
i'm going to email you the file

Last edited by nck; 02-19-2009 at 02:48 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1607 (permalink)  
Old 02-20-2009, 02:15 AM
Junior Member
 
Join Date: Feb 2009
Posts: 1
Zicky44 is on a distinguished road
Help with adding feature to EA

I am testing an EA on demo account and would to add stop loss trailing methods to it. I have a seperate ea that handles the stop loss trailing methods where you can select the one you want. Would appreciate any feedback. Thank you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1608 (permalink)  
Old 02-23-2009, 12:24 AM
Junior Member
 
Join Date: Feb 2009
Posts: 3
dkforex is on a distinguished road
sell EA

Hi,

I looking for a just sell EA. If you have something like that, just put it here please. I want to write a sell EA what included some indicators... thanx your help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1609 (permalink)  
Old 02-23-2009, 05:19 PM
Junior Member
 
Join Date: Jun 2008
Posts: 19
Pied Piper is an unknown quantity at this point
Question Universal MA Cross EA on FxPro Platform

Can any gracious coder/FxPro trader kindly figure out why I can't use this EA on FxPro's MT4 platform. I just can't seem to get EA to open a single trade for the life of me even with the default settings after many days.

FxPro uses the 5-digit format for their price and I've been wondering whether it's the reason. Can this be modified in the code? Someone pls help, it's slowly driving me nuts. Thanx in anticipation
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #1610 (permalink)  
Old 02-23-2009, 06:28 PM
leeb's Avatar
Senior Member
 
Join Date: Dec 2005
Posts: 368
leeb is on a distinguished road
Coding EA for base currency other than USD

Hi everyone,

Great forum :-)
I would like to know, I use money management to calculate lot size in my EA's, up until now my base currency has always been USD but could someone provide some code to calculate lot size if base currency is not USD, for example EUR etc ? Thanks in advance !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks

Tags
#include, candle time, CHinGsMAroonCLK, code, coders guru, conditionally, dll, eli hayun, Eur_harvester.ex4, expert adviser, expert advisor, forex, higher high, how to code, indicator, I_XO_A_H, kehedge, mechanical trading, metatrader command line, mt4, MT4-LevelStop-Reverse, OrderReliable.mqh, programming, rectangle tool, trading, volty channel stop


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to code this? iscuba11 Metatrader 4 mql 4 - Development course 1 08-03-2007 05:22 PM


All times are GMT. The time now is 11:13 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.