약간의 조정이 필요합니다 - 페이지 3 12345678910...18 새 코멘트 Сергей Дыбленко 2020.06.15 18:18 #21 붙였습니다-----아무것도 주지 않았습니다 //+------------------------------------------------------------------+ int Order( string _Order) { int i,ticket= 0 ; _sl = 0.0 ; _tp = 0.0 ; if (_Order== "BUY" ) { for (i= 0 ; i<MaxOrderAtOnceTime; i++) { ticket= OrderSend ( Symbol (),OP_BUYSTOP,Lots,Ask,Slippage,_sl,_tp, "" ,Magic, 0 ,Blue); } } else { for (i= 0 ; i<MaxOrderAtOnceTime; i++) { ticket= OrderSend ( Symbol (),OP_SELLSTOP,Lots,Bid,Slippage,_sl,_tp, "" ,Magic, 0 ,Red); } } return (ticket); } //+------------------------------------------------------------------+ [삭제] 2020.06.15 18:24 #22 Сергей Дыбленко : 붙였습니다-----아무것도 주지 않았습니다 여기에서 수정할 수 있습니다 https://www.mql5.com/ru/code/23470 //+------------------------------------------------------------------+ //| OrderLimit.mq4 | //| Pavel Shukin | //| fibo.rich@gmail.com | //+------------------------------------------------------------------+ #property copyright "Pavel Shukin " #property link "fibo.rich@gmail.com" #property version "1.00" #property strict #property description "Cкрипт устанавливает лимитный ордер buy или sell." #property description "Если текущая (Bid) цена выше (больше) цены, по которой был бронен скрипт," #property description "то будет установлен Order BuyLimit." #property description "Если текущая (Bid) цена ниже (меньше) цены, по которой был бронен скрипт," #property description "то будет установлен Order SellLimit." #property script_show_inputs input double Lots= 0.01 ; //Volume Position extern int TakeProfit= 40 ; extern int StopLoss= 20 ; input int Slippage= 30 ; //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart () { if ( Digits == 3 || Digits == 5 ) { TakeProfit*= 10 ; StopLoss*= 10 ; } //--define price setting script double PriceClick= NormalizeDouble (WindowPriceOnDropped(), Digits ); //--define current price double PriceCurrent= NormalizeDouble (Bid, Digits ); //--условие opening BuyLimit if (PriceClick<PriceCurrent) { BuyLimit(Lots,PriceClick,Slippage); } //--условие opening SellLimit if (PriceClick>PriceCurrent) { SellLimit(Lots,PriceClick,Slippage); } } //+------------------------------------------------------------------+ //Function for opening BuyLimit //+------------------------------------------------------------------+ void BuyLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_BUYLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening BuyLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price-(StopLoss* Point ), Digits ); double tp= NormalizeDouble (open_price+(TakeProfit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify order BuyLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ //Function for opening SellLimit //+------------------------------------------------------------------+ void SellLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_SELLLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening SellLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price+(StopLoss* Point ), Digits ); double tp= NormalizeDouble (open_price-(TakeProfit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify Order SellLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ scriptOrderLimit www.mql5.com Helpercent Предназначен для ручной торговли. Выставляет сделки с указанным риском. Стоплос - обязательный параметр, при помощи которого автоматически определяется направление ордера. Simple Trading Простая библиотека для MT4, содержащая базовый... Сергей Дыбленко 2020.06.15 18:57 #23 지금 바로 볼게요........... Сергей Дыбленко 2020.06.15 19:06 #24 이것을 넣어 - 제로 결과 //+------------------------------------------------------------------+ //Function for opening BuyLimit //+------------------------------------------------------------------+ void BuyLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_BUYLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening BuyLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price-(StopLoss* Point ), Digits ); double tp= NormalizeDouble (open_price+(TakeProfit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify order BuyLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ //Function for opening SellLimit //+------------------------------------------------------------------+ void SellLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_SELLLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening SellLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price+(StopLoss* Point ), Digits ); double tp= NormalizeDouble (open_price-(TakeProfit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify Order SellLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ [삭제] 2020.06.15 19:30 #25 Сергей Дыбленко : 이것을 넣어 - 제로 결과 내가 여기서 망쳤어 - 네! 트롤을 교체했지만 제대로 작동하지 않았습니다. //+------------------------------------------------------------------+ //| InstantExecution.mq4 | //| Copyright 2015, @traderconfident | //| https://confident-trader.blogspot.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, @traderconfident" #property link "https://confident-trader.blogspot.com" #property version "1.0" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ input string _Orders_= " --- Set Order ---" ; input double Lots = 0.05 ; input int StopLoss = 1400 ; input int TakeProfit = 700 ; input int TrailingStart = 200 ; input double TrailingStop = 300 ; // Фиксированный размер трала input double TrailingStep = 50 ; // Шаг трала input string _OrdersLimit= " --- Set OrderLimit ---" ; input int TakeProfitLimit = 40 ; input int StopLossLimit = 20 ; input int Slippage = 30 ; input int Magic = 90910 ; //------- bool AllPositions = false ; // Управлять всеми позициями bool ProfitTrailing = true ; // Тралить только профит bool UseSound = true ; // Использовать звуковой сигнал string NameFileSound = "expert.wav" ; // Наименование звукового файла double _sl,_tp,_pip; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit () { _pip= Point ; if ( Digits == 3 || Digits == 5 ) _pip= 10 * Point ; //--- ObjectCreate ( 0 , "CloseButton" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_XDISTANCE , 10 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_XSIZE , 100 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "CloseButton" , OBJPROP_TEXT , "Close Orders" ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_BGCOLOR ,Red); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_BORDER_COLOR ,Red); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_FONTSIZE , 12 ); //Exit ObjectCreate ( 0 , "OrderLimit" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_XDISTANCE , 120 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_XSIZE , 80 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "OrderLimit" , OBJPROP_TEXT , "OrderLimit" ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_BGCOLOR ,Green); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_BORDER_COLOR ,Green); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_FONTSIZE , 12 ); //Buy ObjectCreate ( 0 , "Buy" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_XDISTANCE , 210 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_XSIZE , 50 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "Buy" , OBJPROP_TEXT , "Buy" ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "Buy" , OBJPROP_BGCOLOR ,Blue); ObjectSetInteger ( 0 , "Buy" , OBJPROP_BORDER_COLOR ,Blue); ObjectSetInteger ( 0 , "Buy" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_FONTSIZE , 12 ); //Sell ObjectCreate ( 0 , "Sell" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_XDISTANCE , 270 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_XSIZE , 50 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "Sell" , OBJPROP_TEXT , "Sell" ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "Sell" , OBJPROP_BGCOLOR ,Gray); ObjectSetInteger ( 0 , "Sell" , OBJPROP_BORDER_COLOR ,Gray); ObjectSetInteger ( 0 , "Sell" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_FONTSIZE , 12 ); //Closed at Profit ObjectCreate ( 0 , "CloseAtProfit" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_XDISTANCE , 330 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_XSIZE , 100 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "CloseAtProfit" , OBJPROP_TEXT , "Close Profit" ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_BGCOLOR ,Green); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_BORDER_COLOR ,Green); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_FONTSIZE , 12 ); //--- return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ int start() { if (TrailingStart> 0 ) TrailStopOrders(); OnChartEvent1(); return ( 0 ); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent1() { int ticket; if ( ObjectGetInteger ( 0 , "CloseAtProfit" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_STATE , 0 ); CloseAtProfit(); } if ( ObjectGetInteger ( 0 , "CloseButton" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_STATE , 0 ); CloseALL(); } if ( ObjectGetInteger ( 0 , "OrderLimit" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_STATE , 0 ); OnStartLimit(); } if ( ObjectGetInteger ( 0 , "Buy" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "Buy" , OBJPROP_STATE , 0 ); { ticket= OrderSend ( Symbol (),OP_BUY,Lots,Ask, 3 ,Bid-StopLoss* Point ,Ask+TakeProfit* Point , "" ,Magic, 0 ,Green); if (ticket> 0 ) { if ( OrderSelect (ticket,SELECT_BY_TICKET,MODE_TRADES)) Print ( "BUY order opened : " ,OrderOpenPrice()); } else Print ( "Error opening BUY order : " , GetLastError ()); return ; } } if ( ObjectGetInteger ( 0 , "Sell" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "Sell" , OBJPROP_STATE , 0 ); { ticket= OrderSend ( Symbol (),OP_SELL,Lots,Bid, 3 ,Ask+StopLoss* Point ,Bid-TakeProfit* Point , "" ,Magic, 0 ,Red); if (ticket> 0 ) { if ( OrderSelect (ticket,SELECT_BY_TICKET,MODE_TRADES)) Print ( "SELL order opened : " ,OrderOpenPrice()); } else Print ( "Error opening SELL order : " , GetLastError ()); } return ; } } //+------------------------------------------------------------------+ void TrailStopOrders() { for ( int i= 0 ; i< OrdersTotal (); i++) { if ( OrderSelect (i,SELECT_BY_POS, MODE_TRADES)) { if (AllPositions || OrderSymbol()== Symbol ()) { TrailingPositions(); } } } } //+------------------------------------------------------------------+ //| Сопровождение позиции простым тралом | //+------------------------------------------------------------------+ void TrailingPositions() { double pBid,pAsk,pp; pp=MarketInfo(OrderSymbol(),MODE_POINT); if (OrderType()==OP_BUY) { pBid=MarketInfo(OrderSymbol(),MODE_BID); if (!ProfitTrailing || (pBid-OrderOpenPrice())>TrailingStop*pp) { if (OrderStopLoss()<pBid-(TrailingStop+TrailingStep- 1 )*pp) { ModifyStopLoss(pBid-TrailingStop*pp); return ; } } } if (OrderType()==OP_SELL) { pAsk=MarketInfo(OrderSymbol(),MODE_ASK); if (!ProfitTrailing || OrderOpenPrice()-pAsk>TrailingStop*pp) { if (OrderStopLoss()>pAsk+(TrailingStop+TrailingStep- 1 )*pp || OrderStopLoss()== 0 ) { ModifyStopLoss(pAsk+TrailingStop*pp); return ; } } } } //+------------------------------------------------------------------+ //| Перенос уровня StopLoss | //| Параметры: | //| ldStopLoss - уровень StopLoss | //+------------------------------------------------------------------+ void ModifyStopLoss( double ldStopLoss) { bool fm; fm=OrderModify(OrderTicket(),OrderOpenPrice(),ldStopLoss,OrderTakeProfit(), 0 ,CLR_NONE); if (fm && UseSound) PlaySound (NameFileSound); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CloseAtProfit() { int ticket= 0 ; RefreshRates(); for ( int cnt= 0 ; cnt< OrdersTotal (); cnt++) { ticket= OrderSelect (cnt,SELECT_BY_POS,MODE_TRADES); if (OrderSymbol()== Symbol () && OrderType()==OP_BUY && Bid>OrderOpenPrice()) { ticket=OrderClose(OrderTicket(),OrderLots(),Bid, 0 ,Violet); } if (OrderSymbol()== Symbol () && OrderType()==OP_SELL && OrderOpenPrice()>Ask) { ticket=OrderClose(OrderTicket(),OrderLots(),Ask, 0 ,Violet); } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CloseALL() { int Close_ticket= 0 ; int total= OrdersTotal (); int i = 0 ; for (i = total; i >= 0 ; i--) { if ( OrderSelect (i,SELECT_BY_POS) && OrderSymbol()== Symbol ()) { //OrderSelect(i,SELECT_BY_POS); if (OrderSymbol()== Symbol () && (OrderType()==OP_BUY || OrderType()==OP_SELL)) { Close_ticket = OrderClose(OrderTicket(),OrderLots(),MarketInfo( Symbol (),MODE_ASK), 5 ); Close_ticket = OrderClose(OrderTicket(),OrderLots(),MarketInfo( Symbol (),MODE_BID), 5 ); } } } } //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStartLimit() { //--define price setting script double PriceClick= NormalizeDouble (WindowPriceOnDropped(), Digits ); //--define current price double PriceCurrent= NormalizeDouble (Bid, Digits ); //--условие opening BuyLimit if (PriceClick<PriceCurrent) { BuyLimit(Lots,PriceClick,Slippage); } //--условие opening SellLimit if (PriceClick>PriceCurrent) { SellLimit(Lots,PriceClick,Slippage); } } //+------------------------------------------------------------------+ //Function for opening BuyLimit //+------------------------------------------------------------------+ void BuyLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_BUYLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening BuyLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price-(StopLossLimit* Point ), Digits ); double tp= NormalizeDouble (open_price+(TakeProfitLimit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify order BuyLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ //Function for opening SellLimit //+------------------------------------------------------------------+ void SellLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_SELLLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening SellLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price+(StopLossLimit* Point ), Digits ); double tp= NormalizeDouble (open_price-(TakeProfitLimit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify Order SellLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ 파일: InstantExecution.mq4 28 kb Сергей Дыбленко 2020.06.15 19:55 #26 나는 어제 이것을 망쳤다. //+------------------------------------------------------------------+ //| RSI.mq4 | //| Copyright © 2016, Хлыстов Владимир | //| cmillion@narod.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2016, Хлыстов Владимир" #property link "cmillion@narod.ru" #property strict #property description "советник по RSI" #property description "sell при пересечение сверху вниз 70 и на buy снизу вверх 30" #property description "стопы и тейки можно выстовить в настройках советника" //-------------------------------------------------------------------- extern int period_RSI = 56 , stoploss = 0 , takeprofit = 250 , slippage = 0 , buy_level = 52 , sell_level = 52 , Magic = 777 ; extern double Lot = 0.1 ; //-------------------------------------------------------------------- void OnTick () { for ( int i= 0 ; i< OrdersTotal (); i++) if ( OrderSelect (i,SELECT_BY_POS,MODE_TRADES)) if (OrderSymbol()== Symbol () && Magic==OrderMagicNumber()) return ; double RSI0 = iRSI ( NULL , 0 ,period_RSI, PRICE_OPEN , 0 ); double RSI1 = iRSI ( NULL , 0 ,period_RSI, PRICE_OPEN , 1 ); double SL= 0 ,TP= 0 ; if (RSI0 > buy_level && RSI1 < buy_level) { if (takeprofit!= 0 ) TP = NormalizeDouble (Ask + takeprofit* Point , Digits ); if (stoploss!= 0 ) SL = NormalizeDouble (Ask - stoploss* Point , Digits ); if ( OrderSend ( Symbol (),OP_BUYLIMIT, Lot, NormalizeDouble (Ask, Digits ),slippage,SL,TP, NULL ,Magic)==- 1 ) Print ( GetLastError ()); if ( OrderSend ( Symbol (),OP_BUYSTOP, Lot, NormalizeDouble (Ask, Digits ),slippage,SL,TP, NULL ,Magic)==- 1 ) Print ( GetLastError ()); } if (RSI0 < sell_level && RSI1 > sell_level) { if (takeprofit!= 0 ) TP = NormalizeDouble (Bid - takeprofit* Point , Digits ); if (stoploss!= 0 ) SL = NormalizeDouble (Bid + stoploss* Point , Digits ); if ( OrderSend ( Symbol (),OP_SELLLIMIT,Lot, NormalizeDouble (Bid, Digits ),slippage,SL,TP, NULL ,Magic)==- 1 ) Print ( GetLastError ()); if ( OrderSend ( Symbol (),OP_SELLSTOP,Lot, NormalizeDouble (Bid, Digits ),slippage,SL,TP, NULL ,Magic)==- 1 ) Print ( GetLastError ()); } } //-------------------------------------------------------------------- [삭제] 2020.06.15 20:07 #27 Сергей Дыбленко : 나는 어제 이것을 망쳤다. 나는 그가 한계를 설정하고 항상 설정하지 않는 방법을 이해하지 못합니다 그리고 조금 변했다 //+------------------------------------------------------------------+ //| InstantExecution.mq4 | //| Copyright 2015, @traderconfident | //| https://confident-trader.blogspot.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, @traderconfident" #property link "https://confident-trader.blogspot.com" #property version "1.0" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ input string _Orders_= " --- Set Order ---" ; input double Lots = 0.05 ; input int StopLoss = 1400 ; input int TakeProfit = 700 ; input int TrailingStart = 200 ; input double TrailingStop = 300 ; // Фиксированный размер трала input double TrailingStep = 50 ; // Шаг трала input int Magic = 90910 ; //------- int Slippage = 30 ; bool AllPositions = false ; // Управлять всеми позициями bool ProfitTrailing = true ; // Тралить только профит bool UseSound = true ; // Использовать звуковой сигнал string NameFileSound = "expert.wav" ; // Наименование звукового файла double _sl,_tp,_pip; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit () { _pip= Point ; if ( Digits == 3 || Digits == 5 ) _pip= 10 * Point ; //--- ObjectCreate ( 0 , "CloseButton" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_XDISTANCE , 10 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_XSIZE , 100 ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "CloseButton" , OBJPROP_TEXT , "Close Orders" ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_BGCOLOR ,Red); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_BORDER_COLOR ,Red); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_FONTSIZE , 12 ); //Exit ObjectCreate ( 0 , "OrderLimit" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_XDISTANCE , 120 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_XSIZE , 80 ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "OrderLimit" , OBJPROP_TEXT , "OrderLimit" ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_BGCOLOR ,Green); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_BORDER_COLOR ,Green); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_FONTSIZE , 12 ); //Buy ObjectCreate ( 0 , "Buy" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_XDISTANCE , 210 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_XSIZE , 50 ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "Buy" , OBJPROP_TEXT , "Buy" ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "Buy" , OBJPROP_BGCOLOR ,Blue); ObjectSetInteger ( 0 , "Buy" , OBJPROP_BORDER_COLOR ,Blue); ObjectSetInteger ( 0 , "Buy" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "Buy" , OBJPROP_FONTSIZE , 12 ); //Sell ObjectCreate ( 0 , "Sell" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_XDISTANCE , 270 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_XSIZE , 50 ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "Sell" , OBJPROP_TEXT , "Sell" ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "Sell" , OBJPROP_BGCOLOR ,Gray); ObjectSetInteger ( 0 , "Sell" , OBJPROP_BORDER_COLOR ,Gray); ObjectSetInteger ( 0 , "Sell" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "Sell" , OBJPROP_FONTSIZE , 12 ); //Closed at Profit ObjectCreate ( 0 , "CloseAtProfit" , OBJ_BUTTON , 0 , 0 , 0 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_XDISTANCE , 330 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_YDISTANCE , 15 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_XSIZE , 100 ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_YSIZE , 25 ); ObjectSetString ( 0 , "CloseAtProfit" , OBJPROP_TEXT , "Close Profit" ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_COLOR ,White); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_BGCOLOR ,Green); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_BORDER_COLOR ,Green); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_BORDER_TYPE , BORDER_FLAT ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_HIDDEN , true ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_STATE , false ); ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_FONTSIZE , 12 ); //--- return ( INIT_SUCCEEDED ); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ int start() { if (TrailingStart> 0 ) TrailStopOrders(); OnChartEvent1(); return ( 0 ); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent1() { int ticket; if ( ObjectGetInteger ( 0 , "CloseAtProfit" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "CloseAtProfit" , OBJPROP_STATE , 0 ); CloseAtProfit(); } if ( ObjectGetInteger ( 0 , "CloseButton" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "CloseButton" , OBJPROP_STATE , 0 ); CloseALL(); } if ( ObjectGetInteger ( 0 , "OrderLimit" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "OrderLimit" , OBJPROP_STATE , 0 ); OnStartLimit(); } if ( ObjectGetInteger ( 0 , "Buy" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "Buy" , OBJPROP_STATE , 0 ); { ticket= OrderSend ( Symbol (),OP_BUY,Lots,Ask, 3 ,Bid-StopLoss* Point ,Ask+TakeProfit* Point , "" ,Magic, 0 ,Green); if (ticket> 0 ) { if ( OrderSelect (ticket,SELECT_BY_TICKET,MODE_TRADES)) Print ( "BUY order opened : " ,OrderOpenPrice()); } else Print ( "Error opening BUY order : " , GetLastError ()); return ; } } if ( ObjectGetInteger ( 0 , "Sell" , OBJPROP_STATE )!= 0 ) { ObjectSetInteger ( 0 , "Sell" , OBJPROP_STATE , 0 ); { ticket= OrderSend ( Symbol (),OP_SELL,Lots,Bid, 3 ,Ask+StopLoss* Point ,Bid-TakeProfit* Point , "" ,Magic, 0 ,Red); if (ticket> 0 ) { if ( OrderSelect (ticket,SELECT_BY_TICKET,MODE_TRADES)) Print ( "SELL order opened : " ,OrderOpenPrice()); } else Print ( "Error opening SELL order : " , GetLastError ()); } return ; } } //+------------------------------------------------------------------+ void TrailStopOrders() { for ( int i= 0 ; i< OrdersTotal (); i++) { if ( OrderSelect (i,SELECT_BY_POS, MODE_TRADES)) { if (AllPositions || OrderSymbol()== Symbol ()) { TrailingPositions(); } } } } //+------------------------------------------------------------------+ //| Сопровождение позиции простым тралом | //+------------------------------------------------------------------+ void TrailingPositions() { double pBid,pAsk,pp; pp=MarketInfo(OrderSymbol(),MODE_POINT); if (OrderType()==OP_BUY) { pBid=MarketInfo(OrderSymbol(),MODE_BID); if (!ProfitTrailing || (pBid-OrderOpenPrice())>TrailingStop*pp) { if (OrderStopLoss()<pBid-(TrailingStop+TrailingStep- 1 )*pp) { ModifyStopLoss(pBid-TrailingStop*pp); return ; } } } if (OrderType()==OP_SELL) { pAsk=MarketInfo(OrderSymbol(),MODE_ASK); if (!ProfitTrailing || OrderOpenPrice()-pAsk>TrailingStop*pp) { if (OrderStopLoss()>pAsk+(TrailingStop+TrailingStep- 1 )*pp || OrderStopLoss()== 0 ) { ModifyStopLoss(pAsk+TrailingStop*pp); return ; } } } } //+------------------------------------------------------------------+ //| Перенос уровня StopLoss | //| Параметры: | //| ldStopLoss - уровень StopLoss | //+------------------------------------------------------------------+ void ModifyStopLoss( double ldStopLoss) { bool fm; fm=OrderModify(OrderTicket(),OrderOpenPrice(),ldStopLoss,OrderTakeProfit(), 0 ,CLR_NONE); if (fm && UseSound) PlaySound (NameFileSound); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CloseAtProfit() { int ticket= 0 ; RefreshRates(); for ( int cnt= 0 ; cnt< OrdersTotal (); cnt++) { ticket= OrderSelect (cnt,SELECT_BY_POS,MODE_TRADES); if (OrderSymbol()== Symbol () && OrderType()==OP_BUY && Bid>OrderOpenPrice()) { ticket=OrderClose(OrderTicket(),OrderLots(),Bid, 0 ,Violet); } if (OrderSymbol()== Symbol () && OrderType()==OP_SELL && OrderOpenPrice()>Ask) { ticket=OrderClose(OrderTicket(),OrderLots(),Ask, 0 ,Violet); } } } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void CloseALL() { int Close_ticket= 0 ; int total= OrdersTotal (); int i = 0 ; for (i = total; i >= 0 ; i--) { if ( OrderSelect (i,SELECT_BY_POS) && OrderSymbol()== Symbol ()) { //OrderSelect(i,SELECT_BY_POS); if (OrderSymbol()== Symbol () && (OrderType()==OP_BUY || OrderType()==OP_SELL)) { Close_ticket = OrderClose(OrderTicket(),OrderLots(),MarketInfo( Symbol (),MODE_ASK), 5 ); Close_ticket = OrderClose(OrderTicket(),OrderLots(),MarketInfo( Symbol (),MODE_BID), 5 ); } } } } //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStartLimit() { if ( Digits == 3 || Digits == 5 ) { } //--define price setting script double PriceClick= NormalizeDouble (WindowPriceOnDropped(), Digits ); //--define current price double PriceCurrent= NormalizeDouble (Bid, Digits ); //--условие opening BuyLimit if (PriceClick<PriceCurrent) { BuyLimit(Lots,PriceClick,Slippage); } //--условие opening SellLimit if (PriceClick>PriceCurrent) { SellLimit(Lots,PriceClick,Slippage); } } //+------------------------------------------------------------------+ //Function for opening BuyLimit //+------------------------------------------------------------------+ void BuyLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_BUYLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening BuyLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price-(StopLoss* Point ), Digits ); double tp= NormalizeDouble (open_price+(TakeProfit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify order BuyLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ //Function for opening SellLimit //+------------------------------------------------------------------+ void SellLimit( double lots, double open_price, int slippage) { int ticket= OrderSend ( Symbol (),OP_SELLLIMIT,lots,open_price,slippage, 0 , 0 , "ScriptOrderLimit" , 0 , 0 , clrNONE ); if (ticket< 0 ) Print ( "Error opening SellLimit " , GetLastError ()); else { double sl= NormalizeDouble (open_price+(StopLoss* Point ), Digits ); double tp= NormalizeDouble (open_price-(TakeProfit* Point ), Digits ); if (!OrderModify(ticket,open_price,sl,tp, 0 , clrNONE )) Print ( "Error Modify Order SellLimit " , GetLastError ()); } } //+------------------------------------------------------------------+ 파일: InstantExecution.mq4 27 kb Сергей Дыбленко 2020.06.15 20:20 #28 지금 나는 여전히 데모에서 플레이하고 있으며 오늘은 아마 괜찮을 것입니다............. [삭제] 2020.06.15 20:23 #29 Сергей Дыбленко : 지금 나는 여전히 데모에서 플레이하고 있으며 오늘은 아마 괜찮을 것입니다............. 이것을 하나 더 추가하십시오. 그런 다음 전문가를 삭제하면 버튼이 남아 있습니다. //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit ( const int reason) { //--- ObjectsDeleteAll (); } //+------------------------------------------------------------------+ Сергей Дыбленко 2020.06.15 20:23 #30 흠 ....... 데모에서 제한을 설정하지 않습니다 ((( 12345678910...18 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
붙였습니다-----아무것도 주지 않았습니다
붙였습니다-----아무것도 주지 않았습니다
여기에서 수정할 수 있습니다 https://www.mql5.com/ru/code/23470
이것을 넣어 - 제로 결과
이것을 넣어 - 제로 결과
내가 여기서 망쳤어 - 네! 트롤을 교체했지만 제대로 작동하지 않았습니다.
나는 어제 이것을 망쳤다.
나는 어제 이것을 망쳤다.
나는 그가 한계를 설정하고 항상 설정하지 않는 방법을 이해하지 못합니다
그리고 조금 변했다
지금 나는 여전히 데모에서 플레이하고 있으며 오늘은 아마 괜찮을 것입니다.............
이것을 하나 더 추가하십시오. 그런 다음 전문가를 삭제하면 버튼이 남아 있습니다.