Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course
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
  #1 (permalink)  
Old 11-02-2006, 07:10 PM
Mr.Marketz's Avatar
Senior Member
 
Join Date: Feb 2006
Posts: 350
Mr.Marketz is on a distinguished road
Trouble Shooting

So I’m trying to piece together my first EA… obviously I’m at a dead end. The concept is to combine two functions which are:

Run (close profitable trades) executed every designated (time cycle)
I have two user input options – 1 (define profitable) and 2 define (time cycle). I believe most of the code is in order.

I am left with one last error “end program”... and I can't figure out why. Can someone with a bit more experience at coding please correct what I’m doing wrong? It’s driving me CRAZY!!!

Thanks in advance,
MM
Attached Files
File Type: mq4 Close all profitable positions on time.mq4 (1.4 KB, 26 views)
__________________
F*CK your market analysis.
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
  #2 (permalink)  
Old 11-02-2006, 08:36 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by Mr.Marketz
So I’m trying to piece together my first EA… obviously I’m at a dead end. The concept is to combine two functions which are:

Run (close profitable trades) executed every designated (time cycle)
I have two user input options – 1 (define profitable) and 2 define (time cycle). I believe most of the code is in order.

I am left with one last error “end program”... and I can't figure out why. Can someone with a bit more experience at coding please correct what I’m doing wrong? It’s driving me CRAZY!!!

Thanks in advance,
MM
The "For" do not have an ending bracket
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
  #3 (permalink)  
Old 11-03-2006, 08:28 PM
Mr.Marketz's Avatar
Senior Member
 
Join Date: Feb 2006
Posts: 350
Mr.Marketz is on a distinguished road
Thanks

Did as suggested, and compiles fine now. However upon running it live I noticed it did not work as specified. In other words I set the time update to 15 min and it never initialized the Close All Profitable Positions script. Any thoughts?
__________________
F*CK your market analysis.
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
  #4 (permalink)  
Old 11-03-2006, 10:29 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
PHP Code:
double   LastUpdate CurTime();
//----
if (MathAbs(CurTime()-LastUpdate)> UpdateInterval*60
This will never work, as at each tick you assign at lastUptade the value Curtime(), then, immediately after, you check if there is a difference between both...no.
The right way is:
PHP Code:
if(CurTime() >= LastUpdate UpdateInterval*60)
{
   
BlahBlahBlah;
   
LastUpdate CurTime();

My 2 cents : Why this time trick ? you can check all your orders every tick and close those which have reached your target !

EDIT : sorry, I didn't see it is a Script and not an EA, so there is another reason why it doesn't work : a script is executed only once : if you want to check something periodically, you have to write some loop in the code

Last edited by Michel; 11-03-2006 at 10:38 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
  #5 (permalink)  
Old 11-07-2006, 09:37 PM
Mr.Marketz's Avatar
Senior Member
 
Join Date: Feb 2006
Posts: 350
Mr.Marketz is on a distinguished road
Quote:
Originally Posted by Michel
PHP Code:
double   LastUpdate CurTime();
//----
if (MathAbs(CurTime()-LastUpdate)> UpdateInterval*60
This will never work, as at each tick you assign at lastUptade the value Curtime(), then, immediately after, you check if there is a difference between both...no.
The right way is:
PHP Code:
if(CurTime() >= LastUpdate UpdateInterval*60)
{
   
BlahBlahBlah;
   
LastUpdate CurTime();

My 2 cents : Why this time trick ? you can check all your orders every tick and close those which have reached your target !

EDIT : sorry, I didn't see it is a Script and not an EA, so there is another reason why it doesn't work : a script is executed only once : if you want to check something periodically, you have to write some loop in the code
Thanks Michel,

I might have to leave this one to the pros.

MM
__________________
F*CK your market analysis.
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
  #6 (permalink)  
Old 11-07-2006, 09:48 PM
Senior Member
 
Join Date: Feb 2006
Posts: 587
Michel is on a distinguished road
Quote:
Originally Posted by Mr.Marketz
Thanks Michel,

I might have to leave this one to the pros.

MM
No ! You will never learn if you do not try !
Just write an EA to close your trades, not a script : put your test and the close func in the "start" func without any time-trick, that's all : at every tick the start function is called, there all your trades will be checked and eventually closed.
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


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
Hammer and Shooting Star indicator Marbo Indicators - Metatrader 4 12 03-30-2007 03:07 PM
anyone having trouble with marketiva increase General Discussion 2 02-09-2007 04:08 AM
Trouble with bars pabloschiki Metatrader 4 4 08-29-2006 09:09 PM
having trouble with multiple EAs ycomp Expert Advisors - Metatrader 4 6 03-03-2006 05:41 AM


All times are GMT. The time now is 03:10 PM.



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