假設目前點位在1.3500
希望每跌15點就空一筆,
一直空到下限 1.3400為止,,
//+------------------------------------------------------------------+
//| send_pending.mq4 |
//| Copyright © 2007, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property show_inputs
extern int Level = 5;
extern double Lots = 0.1;
extern int TakeProfit=10;
extern bool Place_buylimit = true;
extern bool Place_selllimit = true;
extern int GridSpacing=15;
extern double GridUpperLimit=1.36;
extern double GridLowerLimit=1.34;
//+------------------------------------------------------------------+
//| script "send pending order with expiration data" |
//+------------------------------------------------------------------+
int start()
{
int ticket,expiration;
double CurrentLevel=0.00;
double point;
//----
point=MarketInfo(Symbol(),MODE_POINT);
expiration=CurTime()+PERIOD_H1*60;
//----
CurrentLevel = GridLowerLimit;
while(CurrentLevel < GridUpperLimit)
while(true)
{
if (Place_selllimit)
if(CurrentLevel < (Bid - (Point * Level)))
ticket=OrderSend(Symbol(),OP_SELLSTOP,Lots,CurrentLevel,0,0,CurrentLevel - (Point*TakeProfit),"SELLSTOP",0,expiration,Red);
if (Place_buylimit)
if(CurrentLevel > (Ask + (Point * Level))) //ONLY BUY ABOVE ASK PRICE
ticket=OrderSend(Symbol(),OP_BUYSTOP,Lots,CurrentLevel,0,0,CurrentLevel + (Point*TakeProfit),"BUYSTOP",0,expiration,Green);
CurrentLevel = CurrentLevel + (GridSpacing * Point);
if(ticket<=0) Print("Error = ",GetLastError());
else { Print("ticket = ",ticket); break; }
//---- 10 seconds wait
Sleep(10000);
}
//----
return(0);
}
//+------------------------------------------------------------------+
沒有留言:
張貼留言