_SET_SELL_LIMIT

Author: Copyright � 2009, MetaQuotes Software Corp.
Orders Execution
It automatically opens orders when conditions are reached
Miscellaneous
It issuies visual alerts to the screenIt plays sound alerts
0 Views
0 Downloads
0 Favorites
_SET_SELL_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(prise-Bid>stlw*Point){
      tick=OrderSend(Symbol(),3,lot,prise,spr,0,0,NULL,magic,0,Red);
      if(tick<1){
        Print("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());      
        Alert("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());
        return;
      }else{PlaySound("expert.wav");}
    }else{
        RefreshRates();
        if(Bid-prise>=spr*Point*2){
          Alert("ÍÅ ïðàâèëüíàÿ öåíà");
          return;
        }
        if(Bid-prise>=0&&Bid-prise<spr*Point){
          tick=OrderSend(Symbol(),1,lot,Bid,spr,0,0,NULL,magic,0,Red);
          if(tick<1){
            Print("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());      
            Alert("Îøèáêà óñòàíîâêè îðäåðà  ¹",GetLastError());
            return;
          }else{PlaySound("expert.wav");}          
        }
        Comment("SET_SELL DISTANSE = ",DoubleToStr((prise-Bid)/Point,0));
        Sleep(200);
        Comment("");
      }
    }
  }
  
Comment("");
return;}
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---