Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1833 1...182618271828182918301831183218331834183518361837183818391840...1965 New comment Порт-моне тв 2021.12.28 21:43 #18321 Tretyakov Rostyslav #: How are the first orders placed? if(Close[1]>Open[1] && CountOrders()==0) if(NewsSellAllow == true) ticket2 = OrderSend(Symbol(),OP_SELLSTOP, LotSk, Bid-(Skachok*Point), Slippage, 0, Bid-((Skachok+TPsk)*Point), "открыт ордер на продажу", Magic, 0, Red); Print("OpenOrderSuccess"); if(Close[1]>Open[1] && CountOrders()==0) if(NewsBuyAllow == true) ticket2 = OrderSend(Symbol(),OP_BUYSTOP, LotSk, Ask+(Skachok*Point), Slippage, 0, Ask+((Skachok+TPsk)*Point), "открыт ордер на покупку", Magic, 0, Blue); Print("OpenOrderSuccess"); Tretyakov Rostyslav 2021.12.28 21:47 #18322 Порт-моне тв #: Let me have a look. Tretyakov Rostyslav 2021.12.28 21:55 #18323 Порт-моне тв #: You have the same condition for both order types if(Close[1]>Open[1] && CountOrders()==0) Порт-моне тв 2021.12.28 22:11 #18324 Tretyakov Rostyslav #: You have the same condition for both order types is that how I want it, both ways, or do I need to add something? Tretyakov Rostyslav 2021.12.28 22:28 #18325 Порт-моне тв #:is that how I want it, both ways, or do I need to add something? Here...modification once at bar opening As for the opening, if you trade on the news, then "Close[1]>Open[1]" is not needed at all. on one side "Close[1]>Open[1]", and on the other side "Close[1]<Open[1]". //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- if(Close[1]>Open[1] && CountOrders()==0) { if(NewsSellAllow == true) { ticket2 = OrderSend(Symbol(),OP_SELLSTOP, LotSk, Bid-(Skachok*Point), Slippage, 0, Bid-((Skachok+TPsk)*Point), "открыт ордер на продажу", Magic, 0, Red); Print("OpenOrderSuccess"); } } if(Close[1]>Open[1] && CountOrders()==0) { if(NewsBuyAllow == true) { ticket2 = OrderSend(Symbol(),OP_BUYSTOP, LotSk, Ask+(Skachok*Point), Slippage, 0, Ask+((Skachok+TPsk)*Point), "открыт ордер на покупку", Magic, 0, Blue); Print("OpenOrderSuccess"); } } if(newbar!=Time[0]) { ModifyOrder(); newbar=Time[0]; } } //+------------------------------------------------------------------+ //| Подсчет открытых ордеров | //+------------------------------------------------------------------+ int CountOrders(int ot=-1) { int cnt=0; int i=OrdersTotal()-1; for(int pos=i;pos>=0;pos--) { if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)) { if(OrderSymbol()==_Symbol&&OrderMagicNumber()==Magic) { if(OrderType()==ot||ot==-1) cnt++; } } } return(cnt); } //+------------------------------------------------------------------+ //| Модификация ордера | //+------------------------------------------------------------------+ void ModifyOrder() { int i=OrdersTotal()-1; for(int pos=i;pos>=0;pos--) { if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)) { if(OrderSymbol()==_Symbol&&OrderMagicNumber()==Magic) { if(OrderType()==OP_BUYSTOP&&OrderOpenPrice()!=Ask+(Skachok*Point)) { if(OrderModify(OrderTicket(), Ask+(Skachok*Point), 0, Ask+((Skachok+TPsk)*Point))) {Print("Ордер модифицирован");} else {Print("Ошибка модификации ордера:", GetLastError());} } if(OrderType()==OP_SELLSTOP&&OrderOpenPrice()!=Bid-(Skachok*Point)) { if(OrderModify(OrderTicket(), Bid-(Skachok*Point), 0, Bid-((Skachok+TPsk)*Point))) {Print("Ордер модифицирован");} else {Print("Ошибка модификации ордера:", GetLastError());} } } } } } //+------------------------------------------------------------------+ Порт-моне тв 2021.12.28 22:35 #18326 Tretyakov Rostyslav #:Here...modification once at bar opening As for the opening, if you trade on the news, then "Close[1]>Open[1]" is not needed at all, and if the candle has a value, then on one side "Close[1]>Open[1]", and on the other side "Close[1]<Open[1]". Thank you, I will try it tomorrow morning. Andrei Sokolov 2021.12.29 13:50 #18327 Greetings. Can you please tell me how to connect an EA to a dll in C# ? I am creating an application and a library From the application works EA #property strict #import "C:\Users\Андрей\source\repos\ConsoleAppForMql\ClassLibraryForMql\bin\Debug\ClassLibraryForMql.dll" void Method(); #import int OnInit(){ Print(" до вызова Method()"); Method(); return(INIT_SUCCEEDED);} void OnDeinit(const int reason){ } void OnTick(){ } Outputs I assume it can't find Method() as it's inside ClassForMql class, but it's not clear how to specify it. Errors, bugs, questions Neural network in the [ARCHIVE!] Any rookie question, Igor Makanu 2021.12.29 14:14 #18328 Andrey Sokolov #:Greetings. Could you please tell me how to connect an EA to a dll in C# ? If it's MT4 then "chew" the articlehttps://www.mql5.com/ru/articles/249 You are waiting for a fascinating journey into the world of uncontrolled exports ))) If it's MT5, start with a little, first connect the test code from Metaquothttps://www.mql5.com/ru/forum/285631 moving average indi from Discussing the article: "Risk EURUSD - Trends, Forecasts Andrei Sokolov 2021.12.29 14:57 #18329 Igor Makanu #:if this is MT4 then "chew on" the articlehttps://www.mql5.com/ru/articles/249 You are in for a fascinating journey into the world of unmanaged exports ))) If it's MT5, start small, first connect the test code from Metacquothttps://www.mql5.com/ru/forum/285631 If so, then 5. 4 will also be needed, but later. Tretyakov Rostyslav 2021.12.29 15:07 #18330 Igor Makanu #:A fascinating journey into the world of uncontrollable exports awaits you )))) It has indeed been very exciting))) 1...182618271828182918301831183218331834183518361837183818391840...1965 New comment
How are the first orders placed?
You have the same condition for both order types
is that how I want it, both ways, or do I need to add something?
is that how I want it, both ways, or do I need to add something?
Here...modification once at bar opening
As for the opening, if you trade on the news, then "Close[1]>Open[1]" is not needed at all.
on one side "Close[1]>Open[1]", and on the other side "Close[1]<Open[1]".
Here...modification once at bar opening
As for the opening, if you trade on the news, then "Close[1]>Open[1]" is not needed at all, and if the candle has a value, then
on one side "Close[1]>Open[1]", and on the other side "Close[1]<Open[1]".
Thank you, I will try it tomorrow morning.
Greetings. Can you please tell me how to connect an EA to a dll in C# ?
I am creating an application and a library

From the application works

EA
Outputs

I assume it can't find Method() as it's inside ClassForMql class, but it's not clear how to specify it.
Greetings. Could you please tell me how to connect an EA to a dll in C# ?
If it's MT4 then "chew" the articlehttps://www.mql5.com/ru/articles/249
You are waiting for a fascinating journey into the world of uncontrolled exports )))
If it's MT5, start with a little, first connect the test code from Metaquothttps://www.mql5.com/ru/forum/285631
if this is MT4 then "chew on" the articlehttps://www.mql5.com/ru/articles/249
You are in for a fascinating journey into the world of unmanaged exports )))
If it's MT5, start small, first connect the test code from Metacquothttps://www.mql5.com/ru/forum/285631
If so, then 5. 4 will also be needed, but later.
A fascinating journey into the world of uncontrollable exports awaits you ))))
It has indeed been very exciting)))