快买加设止损,编程请教
请教编程高手
这个是快买0.3手脚本,自动设置15点止损,不知道哪里有问题,
double getInitSL(double price)
{
double ATRSL;
double LowSL;
ATRSL=price-15*Point;
LowSL=Low[iLowest(NULL,0,MODE_LOW,14,0)];
return(ATRSL);}//加了这个return,这样弄了下就下不了单了。
//+------------------------------------------------------------------+ //| trade.mq4 | //| Copyright ?2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright ?2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" #include #include bool bOrder = false; void Wait() { while( IsTradeContextBusy() ) { Sleep(100); } } //=============== function: getInitSL (returns Prev Bar Low / High +/- cusion amount) double getInitSL(double price) { double ATRSL; double LowSL; ATRSL=price-15*Point; LowSL=Low[iLowest(NULL,0,MODE_LOW,14,0)]; return(ATRSL); } //+------------------------------------------------------------------+ //| script "trading for all money" | //+------------------------------------------------------------------+ int start() { //---- while (!bOrder) { Wait(); RefreshRates(); bOrder=OrderSend(Symbol(),OP_BUY,0.3,Ask,2,getInitSL(Bid),0,"STAR-BUY",0,0,CLR_NONE); if(bOrder<1) { int error=GetLastError(); Print("Error = ",ErrorDescription(error)); return; } } //---- OrderPrint(); //Print(Symbol(),"OP_BUY",0.1,Ask,2,getInitSL(Bid)); return(0); } //+------------------------------------------------------------------+
2楼
:052:
等待等待
韬客社区www.talkfx.co
发表于:2008-11-07 12:32只看该作者
3楼
帮顶。。。。。。:)
韬客社区www.talkfx.co
发表于:2008-11-08 03:10只看该作者
4楼
:handshake 学习学习
韬客社区www.talkfx.co