Forex
Google
New signals service!

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-08-2006, 06:08 AM
Member
 
Join Date: Oct 2005
Posts: 34
yaniv_av is on a distinguished road
Script don't work - need help

Hi,

I am tring to run the following script on MT4 (build 196) and I get an error msg - "Invalid trade parameters".

Code:
//+------------------------------------------------------------------+
//| script "send pending order with expiration data"                 |
//+------------------------------------------------------------------+
int start()
  {
   int    ticket,expiration;
   double point;
//----
   point=MarketInfo(Symbol(),MODE_POINT);
   expiration=CurTime()+PERIOD_M1*5;
//----
   while(true)
     {
      ticket=OrderSend(Symbol(),OP_SELLSTOP,1,Bid-20*point,3,Bid-10*point,0,"some comment",1234,expiration,Green);
      if(ticket<=0) Print("Error = ",ErrorDescription(GetLastError()));
      else { Print("ticket = ",ticket); break; }
      //---- 10 seconds wait
      Sleep(10000);
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
I don't understand the problem .
Can someone help ?
10X !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-08-2006, 07:06 AM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 287
phoenix is on a distinguished road
expiration=CurTime()+PERIOD_M1*5;

the constant value of PERIOD_M1 is 1

this means that you want the order to expire if 5 second later?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-08-2006, 08:15 AM
elihayun's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 350
elihayun is on a distinguished road
Expiration time should be at least 15 minutes
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-08-2006, 12:05 PM
Member
 
Join Date: Oct 2005
Posts: 34
yaniv_av is on a distinguished road
Still don't work ...

ever where I set the expiration variable to 60 (1 minute)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-08-2006, 12:15 PM
phoenix's Avatar
Senior Member
 
Join Date: May 2006
Posts: 287
phoenix is on a distinguished road
what about the other parameters

dose your broker not allow TP and SL to be too close

like they need 15 pips up

Last edited by phoenix; 09-08-2006 at 12:17 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

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 On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help With EA that does not work shorttermtrader Metatrader 4 0 05-02-2007 01:55 PM
This Ea Really Work sps8 Expert Advisors - Metatrader 4 18 04-02-2007 08:30 PM
Help me!!!! Why this EA doesn't work???? metastock Expert Advisors - Metatrader 4 3 02-17-2007 05:31 AM
script that dont work ser71 Setup Questions 1 01-30-2006 04:15 PM
How does this really work? Ayo Questions 0 12-19-2005 02:30 PM


All times are GMT. The time now is 12:25 AM.



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