포럼을 어지럽히 지 않도록 모든 초보자 질문. 프로, 놓치지 마세요. 너 없이는 아무데도 - 6. - 페이지 385 1...378379380381382383384385386387388389390391392...1178 새 코멘트 Alexander 2013.12.30 18:30 #3841 TarasBY : 오류 시 오류. 아마도 다음과 같이 작동할 것입니다. ??? 친애하는 당신이 "오류 온 오류"를 발견한 곳을 지적해 주십시오. TarasBY 2013.12.30 18:31 #3842 Roger : 친애하는, 어디에서 "오류 온 오류"를 찾았습니까? 눈은 이미 감았습니까? 내가 암시하고 있습니다: 주문의 시작 가격을 참조하십시오(이미 앞서 표시된 종료 가격 제외). Alexander 2013.12.30 18:34 #3843 TarasBY : 눈은 이미 감았습니까? 내가 암시하고 있습니다: 주문의 시작 가격을 참조하십시오(이미 앞서 표시된 종료 가격 제외). 세부 사항을 부탁드립니다. TarasBY 2013.12.30 18:39 #3844 if(prof>=Profit) { for(i=OrdersTotal()-1; i>=0; i--) { OrderSelect(i,SELECT_BY_POS); OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),5,0); } } double LineEA = iCustom (Symbol(), 0, "Ind_2 Line+1", 0, 1); // Первый инструмент double LineAU = iCustom (Symbol(), 0, "Ind_2 Line+1", 1, 1); // Второй инструмент if(NumberOfPositions("EURAUD")==0 && LineEA > 0.1 && LineAU < -0.1) { EASell = OrderSend(symEA,OP_SELL,lotEA,bidEA,3,0,0,"KVAZ_EURAUD_AUDUSD",Magic,0,Red); } if(NumberOfPositions("AUDUSD")==0 && LineEA > 0.1 && LineAU < -0.1) { AUSell = OrderSend(symAU,OP_SELL,lotAU,bidAU,3,0,0,"KVAZ_EURAUD_AUDUSD",Magic,0,Red); } if(NumberOfPositions("EURAUD")==0 && LineEA < -0.1 && LineAU > 0.1) { EABuy = OrderSend(symEA,OP_BUY,lotEA,bidEA,3,0,0,"KVAZ_EURAUD_AUDUSD",Magic,0,Red); } if(NumberOfPositions("AUDUSD")==0 && LineEA < -0.1 && LineAU > 0.1) { AUBuy = OrderSend(symAU,OP_BUY,lotAU,bidAU,3,0,0,"KVAZ_EURAUD_AUDUSD",Magic,0,Red); } Alexander 2013.12.30 18:42 #3845 그는 "열지 않음"이 아니라 "닫지 마십시오"라는 명령을 내립니다. 닫는 코드가 맞습니다. [삭제] 2013.12.30 18:56 #3846 extern double Lots = 0.1 ; extern int TakeProfit = 50 ; extern int Step = 50 ; extern double Multipler = 2 ; extern int Slippage = 5 ; extern int Magic = 123 ; int ticket; double price, TP, lastlot; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return ( 0 ); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return ( 0 ); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { if ( CountTrades()== 0 ) { double ima = iMA ( Symbol (), 0 , 14 , 0 , MODE_SMA , PRICE_CLOSE , 1 ); if ( Ask >ima) { ticket = OrderSend ( Symbol (), OP_BUY ,Lots, Ask ,Slippage, 0 , 0 , "" ,Magic, 0 ,Blue); if (ticket> 0 ) { TP = NormalizeDouble ( Ask +TakeProfit* Point , Digits ); OrderModify (ticket, OrderOpenPrice (), 0 ,TP, 0 ); } } else if ( Bid <ima) ticket = OrderSend ( Symbol (), OP_SELL ,Lots, Ask ,Slippage, 0 , 0 , "" ,Magic, 0 ,Red); if (ticket> 0 ) { TP = NormalizeDouble ( Bid -TakeProfit* Point , Digits ); OrderModify (ticket, OrderOpenPrice (), 0 ,TP, 0 ); } } // закрыты все скобки, кроме первой, которая начинает цикл "старт". На этот момент открыт 1й ордер, дальше в // случае потребности доливаемся. else { int order_type = FindLastOrderType(); if (order_type = OP_BUY ) { price = FindLastPrice ( OP_BUY ); if ( Ask <= price - Step* Point ) { lastlot = FindLastLots ( OP_BUY ); lastlot = NormalizeDouble (lastlot* Multipler, 2 ); ticket = OrderSend ( Symbol (), OP_BUY ,lastlot, Ask ,Slippage, 0 , 0 , "" ,Magic, 0 ,Blue); if (ticket> 0 ) ModifyOrders ( OP_BUY ); } } else if (order_type = OP_SELL () { price = FindLastPrice ( OP_SELL ); if ( Bid <= price + Step* Point ) { lastlot = FindLastLots ( OP_SELL ); lastlot = NormalizeDouble (lastlot* Multipler, 2 ); ticket = OrderSend ( Symbol (), OP_SELL ,lastlot, Bid ,Slippage, 0 , 0 , "" ,Magic, 0 ,Blue); if (ticket> 0 ) ModifyOrders ( OP_SELL ); } } } return ( 0 ); } //+------------------------------------------------------------------+ void ModifyOrder( int otype) { double avgprice = 0 , order_lots = 0 ; price = 0 ; for ( int i = OrdersTotal ()- 1 ; i>= 0 ; i--) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Magic && OrderType () == otype) { price += OrderOpenPrice () * OrderLots (); order_lots += OrderLots (); } } } avgprice = NormalizeDouble (price / order_lots, Digits ); if (otype == OP_BUY ) TP = NormalizeDouble (avgprice + TakeProfit * Point , Digits ); if (otype == OP_SELL ) TP = NormalizeDouble (avgprice - TakeProfit * Point , Digits ); for (i = OrdersTotal ()- 1 ; i>= 0 ; i--) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Magic && OrderType () == otype) OrderModify ( OrderTicket (), OrderOpenPrice (), 0 ,TP, 0 ); } } } //+------------------------------------------------------------------+ double FindLastLots ( int otype) { double oldopenprice,oldlots; int oldticket; ticket = 0 ; for ( int i = OrdersTotal ()- 1 ; i>= 0 ; i--) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Magic && OrderType () == otype) { oldticket = OrderTicket (); if (oldticket>ticket) { oldlots = OrderLots (); ticket = oldticket; } } } } return (oldlots); } //+------------------------------------------------------------------+ double FindLastPrice ( int otype) { double oldopenprice; int oldticket; ticket = 0 ; for ( int i = OrdersTotal ()- 1 ; i>= 0 ; i--) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Magic && OrderType () == otype) { oldticket = OrderTicket (); if (oldticket>ticket) { oldopenprice = OrderOpenPrice (); ticket = oldticket; } } } } return (oldopenprice); } //+------------------------------------------------------------------+ int FindLastOrderType() { for ( int i = OrdersTotal ()- 1 ; i>= 0 ; i--) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Magic) return ( OrderType ()); } } return (- 1 ); } //+------------------------------------------------------------------+ int CountTrades() { int count = 0 ; for ( int i = OrdersTotal ()- 1 ; i>= 0 ; i--) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { if ( OrderSymbol ()== Symbol () && OrderMagicNumber ()==Magic) count++; } } return (count); } //+------------------------------------------------------------------+ 여러분, 부엉이에서 오류를 찾는 데 도움을 주십시오. 컴파일되지 않습니다. Alekseu Fedotov 2013.12.30 18:58 #3847 alexey1979621 : 하긴 했는데 위의 부엉이와 관련하여 문제가 해결되지 않습니다. 닫을 때 고문은 단순히 기호와 마법으로 명령을 보지 않고 닫을 필요가 있다고 생각합니다. 옵션은 간단하고(테스트용) 작동하며 그는 모든 것을 봅니다. Alexey Semenov 2013.12.30 19:01 #3848 TarasBY : 감사합니다. 코드를 정리했습니다. 실제로 오프닝에 오류가 있습니다(눈이 이미 흐릿함). 저는 변환된 Expert Advisor 를 데모에 넣었습니다. 여기에서 우리 Magic의 포지션은 이미 총 흑자 수익으로 열려 있습니다. 그러나 포지션은 폐쇄되지 않았다. Alexey Semenov 2013.12.30 19:06 #3849 Roger : 그는 상징이나 마술사를 보지 않아야하며 모든 것이 당신의 고문에 올바르게 기록되어 있습니다. 로그를 보면 어떤 오류가 발생하는지 확인하십시오. 로그는 ... 귀하의 의견과 함께 고문의 코드는 다음과 같습니다. extern double lotEU= 0.01 ; extern double lotGU= 0.01 ; extern double Profit= 12 ; extern string Сomment = "KVAZ_EURUSD_GBPUSD" ; extern int Magic = 1114 ; int EUSell, EUBuy, GUSell, GUBuy; double price; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { return ( 0 ); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { return ( 0 ); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { double prof; double bidEU = MarketInfo ( "EURUSD" , MODE_BID ); double askEU = MarketInfo ( "EURUSD" , MODE_ASK ); double bidGU = MarketInfo ( "GBPUSD" , MODE_BID ); double askGU = MarketInfo ( "GBPUSD" , MODE_ASK ); string symEU = "EURUSD" ; string symGU = "GBPUSD" ; if (prof>=Profit) { for ( int i= OrdersTotal ()- 1 ;i>= 0 ;i--) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { double AS= MarketInfo ( OrderSymbol (), MODE_ASK ); double BI= MarketInfo ( OrderSymbol (), MODE_BID ); if ( OrderType ()== OP_BUY ) price=BI; else price=AS; OrderClose ( OrderTicket (), OrderLots (),price, 3 ,CLR_NONE); } } } double LineEU = iCustom ( Symbol (), 0 , "Ind_2 Line+1" , 0 , 1 ); // Первый инструмент double LineGU = iCustom ( Symbol (), 0 , "Ind_2 Line+1" , 1 , 1 ); // Второй инструмент if (NumberOfPositions( "EURUSD" )== 0 && LineEU > 0.1 && LineGU < - 0.1 ) { EUSell = OrderSend (symEU, OP_SELL ,lotEU,bidEU, 3 , 0 , 0 , "KVAZ_EURUSD_GBPUSD" ,Magic, 0 ,Red); } if (NumberOfPositions( "GBPUSD" )== 0 && LineEU > 0.1 && LineGU < - 0.1 ) { GUBuy = OrderSend (symGU, OP_BUY ,lotGU,bidGU, 3 , 0 , 0 , "KVAZ_EURUSD_GBPUSD" ,Magic, 0 ,Blue); } if (NumberOfPositions( "EURUSD" )== 0 && LineEU < - 0.1 && LineGU > 0.1 ) { EUBuy = OrderSend (symEU, OP_BUY ,lotEU,askEU, 3 , 0 , 0 , "KVAZ_EURUSD_GBPUSD" ,Magic, 0 ,Blue); } if (NumberOfPositions( "GBPUSD" )== 0 && LineEU < - 0.1 && LineGU > 0.1 ) { GUSell = OrderSend (symGU, OP_SELL ,lotGU,askGU, 3 , 0 , 0 , "KVAZ_EURUSD_GBPUSD" ,Magic, 0 ,Red); } return ( 0 ); } //+------------------------------------------------------------------+ int NumberOfPositions( string sy= "" , int op=- 1 , int mn= 1114 ) { //| Параметры: | //| sy - наименование инструмента ("" - любой символ, | //| NULL - текущий символ) | //| op - операция (-1 - любая позиция) | //| mn - MagicNumber (-1 - любой магик) int i, k= OrdersTotal (), kp= 0 ; if (sy== "0" ) sy= Symbol (); for (i= 0 ; i<k; i++) { if ( OrderSelect (i, SELECT_BY_POS , MODE_TRADES )) { if ( OrderSymbol ()==sy || sy== "" ) { if ( OrderType ()== OP_BUY || OrderType ()== OP_SELL ) { if (op< 0 || OrderType ()==op) { if (mn< 0 || OrderMagicNumber ()==mn) kp++; } } } } } return (kp); } Alexander 2013.12.30 19:08 #3850 Trader7777 : 여러분, 부엉이에서 오류를 찾는 데 도움을 주십시오. 컴파일되지 않습니다. 이 줄을 봐 그렇지 않으면 ( 주문 유형 = OP_SELL () 1...378379380381382383384385386387388389390391392...1178 새 코멘트 트레이딩 기회를 놓치고 있어요: 무료 트레이딩 앱 복사용 8,000 이상의 시그널 금융 시장 개척을 위한 경제 뉴스 등록 로그인 공백없는 라틴 문자 비밀번호가 이 이메일로 전송될 것입니다 오류 발생됨 Google으로 로그인 웹사이트 정책 및 이용약관에 동의합니다. 계정이 없으시면, 가입하십시오 MQL5.com 웹사이트에 로그인을 하기 위해 쿠키를 허용하십시오. 브라우저에서 필요한 설정을 활성화하시지 않으면, 로그인할 수 없습니다. 사용자명/비밀번호를 잊으셨습니까? Google으로 로그인
오류 시 오류. 아마도 다음과 같이 작동할 것입니다.
???
친애하는 당신이 "오류 온 오류"를 발견한 곳을 지적해 주십시오.
친애하는, 어디에서 "오류 온 오류"를 찾았습니까?
눈은 이미 감았습니까? 내가 암시하고 있습니다: 주문의 시작 가격을 참조하십시오(이미 앞서 표시된 종료 가격 제외).
세부 사항을 부탁드립니다.
하긴 했는데 위의 부엉이와 관련하여 문제가 해결되지 않습니다. 닫을 때 고문은 단순히 기호와 마법으로 명령을 보지 않고 닫을 필요가 있다고 생각합니다.
그는 상징이나 마술사를 보지 않아야하며 모든 것이 당신의 고문에 올바르게 기록되어 있습니다. 로그를 보면 어떤 오류가 발생하는지 확인하십시오.
여러분, 부엉이에서 오류를 찾는 데 도움을 주십시오. 컴파일되지 않습니다.
이 줄을 봐
그렇지 않으면 ( 주문 유형 = OP_SELL ()