Download MetaTrader 5
To add comments, please log in or register
Do you need a programmer? Freelance service will find the developer you need!
jarshi
36
jarshi 2014.08.26 03:17 
Hi , guys , I am new for this ,and i want to write a script about how to set a var price and wait for it fitness carry out instant-buy or instant-sell

and it does not work totoally !

help me !
Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.08.26 08:21  
jarshi:
Here is my script: //+------------------------------------------------------------------+ //| OrderIntime.mq4 | //| Copyright 2014, Jarshi`s | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2014, Jarshi`sQQ:89588391" #property link "https://www.mql5.com" #property version "1.00" #property strict //--- input parameters extern int waiting_time=15; extern double lot_vol=0.1; extern double price_wanted; extern int acting_mode; //0卖,1是买 extern int magic=405215; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- DrawLabel("will1","www.zhinngiaoi.com,QQ:2756892070",2,13,"宋体",9,Aqua,0); //--- return(INIT_SUCCEEDED); } int start() { int if_doit=0; while(if_doit==0) { if(instantDoit(lot_vol,acting_mode,price_wanted, TimeLocal()+waiting_time*60)>0) { if_doit=1; } Sleep(100); } return(0); } //执行立即买入 int instantDoit(double lots,int mode ,double priceat,datetime exptime) { int ticket=0; if(mode==1) { if(priceat=Ask) { ticket=OrderSend(Symbol( ) ,OP_SELL,lots,priceat,0,0,0,Symbol()+"sell",magic,exptime,White); } } if(ticket

Please use the SRC button to post code . . .
/
To add comments, please log in or register