View Single Post
MT4 Problem with BUY script
  #1 (permalink)  
Old 03-31-2008, 08:16 PM
ableze_joepardy ableze_joepardy is offline
Freshman
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
ableze_joepardy is on a distinguished road
Default MT4 Problem with BUY script

hi.. I've modified the default script (trade.mq4) in metatrader platform to execute martingle based trade.. the condition is like below:

Starting lot: 0.1
Multiple: 2
Pips: 8
TP: 10
Max trade: 5

and here's the code..

Code:
//+------------------------------------------------------------------+ //| buy 1 lot.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #include <stdlib.mqh> #include <WinUser32.mqh> //+------------------------------------------------------------------+ //| script "trading for all money" | //+------------------------------------------------------------------+ int start() { //---- if(MessageBox("Do you really want to execute Martingle "+Symbol()+" at ASK price? ", "Script",MB_YESNO|MB_ICONQUESTION)!=IDYES) return(1); //---- int ticket1=OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Ask-40*Point,Ask+10*Point,"GU M5",770,0,CLR_NONE); int ticket2=OrderSend(Symbol(),OP_BUYLIMIT,0.2,Ask-8*Point,3,Ask-40*Point,Ask+2*Point,"GU M5",770,0,CLR_NONE); int ticket3=OrderSend(Symbol(),OP_BUYLIMIT,0.4,Ask-16*Point,3,Ask-40*Point,Ask-6*Point,"GU M5",770,0,CLR_NONE); int ticket4=OrderSend(Symbol(),OP_BUYLIMIT,0.8,Ask-24*Point,3,Ask-40*Point,Ask-14*Point,"GU M5",770,0,CLR_NONE); int ticket5=OrderSend(Symbol(),OP_BUYLIMIT,1.6,Ask-32*Point,3,Ask-40*Point,Ask-22*Point,"GU M5",770,0,CLR_NONE); if(ticket1<1) { int error1=GetLastError(); Print("Error = ",ErrorDescription(error1)); return; } if(ticket2<1) { int error2=GetLastError(); Print("Error = ",ErrorDescription(error2)); return; } if(ticket3<1) { int error3=GetLastError(); Print("Error = ",ErrorDescription(error3)); return; } if(ticket4<1) { int error4=GetLastError(); Print("Error = ",ErrorDescription(error4)); return; } if(ticket5<1) { int error5=GetLastError(); Print("Error = ",ErrorDescription(error5)); return; } //---- OrderPrint(); return(0); } //+------------------------------------------------------------------+
but the code didnt execute the order.. whats wrong with the code?
Reply With Quote

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now