_SET_BUY_LIMIT

Author: Copyright � 2009, MetaQuotes Software Corp.
Profit factor:
0.00
Orders Execution
It automatically opens orders when conditions are reached
Miscellaneous
It issuies visual alerts to the screenIt plays sound alerts
1 Views
0 Downloads
0 Favorites
_SET_BUY_LIMIT
//+------------------------------------------------------------------+
//|                                                     SELL_SET.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
int magic=327;
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
void start(){
  //GlobalVariablesDeleteAll();
  double lot;
  int tick;
  if(!GlobalVariableCheck("lot")){
    GlobalVariableSet("lot",0);
    Alert("Ââåäèòå ðàçìåð ëîòà â ãëîáàëüíóþ ïåðåìåííóþ");
    return;
  }else{
    if(GlobalVariableGet("lot")==0){
      Alert("Ââåäèòå ðàçìåð ëîòà â ãëîáàëüíóþ ïåðåìåííóþ");
      return;    
    }
    lot=GlobalVariableGet("lot");
    if(ObjectFind("order")!=0){
      Alert("Óñòàíîâèòå ëèíèþ îðäåðà");
      return;     
    }
  while(!IsStopped()&&tick==0){    
    double prise=NormalizeDouble(ObjectGet("order",OBJPROP_PRICE1),Digits);
    int stlw=MarketInfo(Symbol(),MODE_STOPLEVEL);
    int spr =MarketInfo(Symbol(),MODE_SPREAD);
    if(Ask-prise>stlw*Point){
      tick=OrderSend(Symbol(),2,lot,prise,spr,0,0,NULL,magic,0,Blue);
      if(tick<1){
        Print("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());      
        Alert("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());
        return;
      }else{PlaySound("expert.wav");}
    }else{
        RefreshRates();
        if(prise-Ask>=spr*Point*2){
          Alert("ÍÅ ïðàâèëüíàÿ öåíà");
          return;
        }        
        if(prise-Ask>=0&&prise-Ask<spr*Point){
          tick=OrderSend(Symbol(),0,lot,prise,spr,0,0,NULL,magic,0,Blue);
          if(tick<1){
            Print("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());      
            Alert("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());
            return;
          }else{PlaySound("expert.wav");}          
        }
        Comment("SET_BUY  DISTANSE = ",DoubleToStr((Ask-prise)/Point,0));
        Sleep(200);
        Comment("");
      }
    }
  }
  
Comment("");
return;}
//+------------------------------------------------------------------+

Comments