Create a Button in MT5 to Close All Open Positions | Easy mql5 EA Programming Tutorial

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025

Комментарии • 126

  • @Devin_78
    @Devin_78 2 года назад

    Extremely helpful and easy to follow. I have no coding experience and was able to muddle my way through. Now I have a "Close All" button for those times I need to exit quickly. Thanks

  • @ashleyvenasio7398
    @ashleyvenasio7398 3 года назад

    Great video mentor... I'm growing each day by repeating all the contents in this channel...by practical application as well...

  • @rayzn4996
    @rayzn4996 Год назад

    Moin René. Vielen dank für deine zahlreichen und super erklärten Videos. Die sind sehr interessant anzuschauen (vor Allem wenn die verschiedene EA´s testest). Gerade dieses hier war für mich besonders hiflreich, da ich mehrere Accounts gleichzeitig trade (als Scalper) und es unendlich nervig war mehrere Trades gleichzeitig mit der Maus zu schließen. Vor allem weil in den paar Sekunden indem ich die Trades schließe der Markt sich gerne mal schon wieder bewegt (ich trade in M1), das war alles sehr stressig :D Du hast es sehr klar und deutlich erklärt und ich konnte es sofort umsetzen und es bringt mir eine super Erleichterung beim traden. Vielen vielen dank und mach weiter so :)
    MfG,
    Finn

    • @ReneBalke
      @ReneBalke  Год назад +1

      Danke für das nette Feedback :) Es freut mich, dass Du etwas darauf mitnehmen kannst!

  • @hada1945
    @hada1945 2 года назад

    I am very thankful for this video. Everything is explained in great detail. Greetings back and also a successful trading.

  • @thabangismael1530
    @thabangismael1530 2 года назад

    Thank you very much. That's what I've been trying to add on my trading robot and now it's easy to do it. Very much appreciated

  • @Kumariello
    @Kumariello 2 года назад

    Very helpful and professional tutorial, thank you so much,I hope you will keep posting stuff like such in future.

  • @siyanasdaq7881
    @siyanasdaq7881 2 года назад +1

    I never thought I'd be able to have my own Button Coded too. Thank you very much
    On the next Button - Perhaps you can make it do a Break Even so that it can protect an Entry point

    • @ReneBalke
      @ReneBalke  2 года назад

      I am glad you liked the video :)

  • @yuniqueclaassen602
    @yuniqueclaassen602 2 года назад +1

    Hey Rene thank you for a great video. Really helped me. What would the code be to have a Stop Loss = Break even function for the second button? I am busy with a close all positions button but want the second one to have a Stop Loss = Break even function so to move the stop loss to break even. Thank you in advance for your reply.

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Hi, I made another tutorial where I showed how you can change the sl of your open positions. You can find it here: ruclips.net/video/3l8RyeQNmNo/видео.html
      You learn pretty much all you need there ;)

  • @PROPHETEMCHAUKE
    @PROPHETEMCHAUKE 3 года назад

    Rene, you always provide valuable information. 👍

  • @Macam2macam
    @Macam2macam 2 года назад

    thank you, sir. this function is very useful and your explanation is also very detail and clear. i want to make a simulator with this button function.

  • @ProSpase
    @ProSpase 2 года назад

    Great tutorial. How can I create a nestled buttons and be able to move them around on the chart as a group?

  • @MayYouLiveLongAndProsper
    @MayYouLiveLongAndProsper 11 месяцев назад

    Excellent ... Just what I have been looking for ... How would I make the button round ?

    • @ReneBalke
      @ReneBalke  11 месяцев назад

      Not sure if there is a good function for it. Maybe you have to use another object for it (some circle) and react on clicks on this object.

    • @MayYouLiveLongAndProsper
      @MayYouLiveLongAndProsper 11 месяцев назад

      @@ReneBalkeNow I have actually made it 75*75 is growing on me ... Looks good :)

    • @MayYouLiveLongAndProsper
      @MayYouLiveLongAndProsper 11 месяцев назад

      How would I write a second line of text on my button ... CLOSE ALL wouldn't wrap

  • @joelmasamuna
    @joelmasamuna 2 года назад

    Thank you for your efforts and commitment, would it be possible to create a EditButton + button to update the stop lost like trailing stop, the editbutton will allow to type the SL et and button to update the position.

    • @ReneBalke
      @ReneBalke  2 года назад

      Thanks for the kind comment :) yes that is possible in the MetaTrader ;)

    • @joelmasamuna
      @joelmasamuna 2 года назад

      @@ReneBalke Would you like to make a video for that

  • @melvinperdomo8368
    @melvinperdomo8368 2 года назад

    Thank you so much!!!! You have no idea how much this has helped me!!!! How can I add a (Move All to Breakeven) function to the second button??? Thanks again!!

    • @melvinperdomo8368
      @melvinperdomo8368 2 года назад

      ... As well as taking partials or take profits???

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Thanks. Glad you liked it :)

  • @dimatistrading
    @dimatistrading 2 года назад

    Amazing video, very clear and helpful. Thank you.

  • @kornkanokmendekli2414
    @kornkanokmendekli2414 Год назад

    Can I create close all button on Ipad too? Thank you sir!

  • @MrDviratis
    @MrDviratis 2 года назад

    Very nice tutorial, and very beginner friendly. Thank you!

  • @arjunv384
    @arjunv384 Год назад

    This is amazing,is there any way to integrate it within a EA

  • @bavarianblessed
    @bavarianblessed 2 года назад

    Thank you for the video! I have the button working but would like it to close only positions on the chart or symbol it's loaded on. Would I need to use PositionGetSymbol for that some how?

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Yes. PositionGetString(POSITION_SYMBOL) == _Symbol

  • @markalli6068
    @markalli6068 2 года назад

    Thanks for the video! Can I modify this to use a keystroke instead of a button?

    • @ReneBalke
      @ReneBalke  2 года назад

      Hey, should be possible but I never did such a thing. But I think you will find something in forums about this :)

  • @segarann
    @segarann 5 месяцев назад

    Tq Very much sir, i manage to do the button!

  • @singmontree5654
    @singmontree5654 Год назад

    Hi Rene, Thank you very much> it is very helpful.
    Btw, i have to remove word "_FUNTION_" then it works.
    I would like to ask that if i am scalping 10 position.
    Then, i would like to have button so call "SL"
    Once, i click SL button. Then, it is given me the box to fill constant figure for stop loss.
    Once i close the box, then all positions got same stop loss.
    i already create the button for both SL and TP by follow your tutorial.
    Thank you in advance.

    • @singmontree5654
      @singmontree5654 Год назад

      or just give me the link of video, if you already have it.

    • @ReneBalke
      @ReneBalke  Год назад +1

      Maybe because it is __FUNCTION__ with two _ before and after. With this adjustment it should work ;)

  • @DingDung-lk3ji
    @DingDung-lk3ji Год назад

    Hello sir, Thank you very much. And I need close all profitable button or close or close all loss button

  • @srikantdhondi
    @srikantdhondi 11 месяцев назад

    How to trigger click event on Buy/Sell buttons on Metatrader Chart window?

    • @ReneBalke
      @ReneBalke  11 месяцев назад

      Best way is to use the OnTradeTransaction event handler if you want to work with trading operations.

  • @mohdridzuan8416
    @mohdridzuan8416 3 месяца назад

    hi bro can give the code how to set the close button to activate by pressing C at the key board to make an option of close position by clicking it tq sooo much

  • @arcadgames6519
    @arcadgames6519 Год назад

    hello, Thank you for these valuable informations,
    Trades are closed sequentially and take time to close
    Can you modify the program so that it closes all trades at the same moment, as happens when you click on Close All Positions in metatrader
    thank you

  • @KimorKim
    @KimorKim Год назад

    Hey Rene, great tutorials. I really like them and they help me a lot. I copied your code as you said but my EA isnt deleting the button on DeInit.... there is no Error. Anny clue what the problem could be?

  • @PROPHETEMCHAUKE
    @PROPHETEMCHAUKE 3 года назад

    Rene can you please make the second button, pause and run thr trades. Lets say if ny expect advisor has opened some trades and i want it not to open more trades i can then click the pause button anf when all thr trades have reached stop loss or take profit i can click the same button to start running the expert advisor to allow trades to open

    • @ReneBalke
      @ReneBalke  3 года назад +1

      Hey, this is really easy. Just declare a global bool variable and make it true, if the button is clicked. If it is clicked again you can store false inside the variable. Before the EA opens a position you can then check the state of the variable. Just give it a go maybe you can implement it this way :)

    • @PROPHETEMCHAUKE
      @PROPHETEMCHAUKE 3 года назад +1

      Okay Rene I will try that

  • @samadesmaeilzadeh1272
    @samadesmaeilzadeh1272 Год назад

    Thank you very much for the excellent explanation.

  • @masimpec
    @masimpec 2 года назад

    Very good... How to include more btn like close on BE, CloseBuy, CloseSell etc

    • @ReneBalke
      @ReneBalke  2 года назад

      Hey, today I will publish another video where I show how to add multiple buttons.. you should watch it ;)

  • @NSAKEY
    @NSAKEY 2 года назад

    This is a great tutorial. Thank you for sharing it. I have managed to create my buttons, but I am trying to get them to work with the bulk operations (Close All Positions & Delete All Orders) since they are much faster, but I cannot seem to figure it out. Any chance you can cover this? Thanks.

    • @bitestonk0618
      @bitestonk0618 Год назад

      same question, bulk is faster

    • @NSAKEY
      @NSAKEY Год назад

      @@bitestonk0618 I figured it out. Bulk operations is not supported yet, but you can use asynchronous mode, which functions the same way.
      m_trade.SetAsyncMode(true)

    • @bitestonk0618
      @bitestonk0618 Год назад

      @@NSAKEY but bulk operation still faster cmiiw

    • @NSAKEY
      @NSAKEY Год назад

      @@bitestonk0618 Not that I can tell. I can close out 100 positions in about 1 second. If there is a difference, it is negligible.

  • @Island_Algorithms
    @Island_Algorithms 3 года назад

    Thank you very much, excellent content as always

  • @pripercat
    @pripercat Год назад

    It works for me if I add the expert advisor to a chart. But if I run it in the strategy tester, no. Why would it be? I also have the Algorithmic Trading button enabled. Regards

    • @ReneBalke
      @ReneBalke  Год назад +1

      Chart objects do not work in the strategy tester unfortunately

    • @pripercat
      @pripercat Год назад

      ​@ReneBalke Very much thanks for your answer. 👍 Regards !

  • @ForexTradeTT
    @ForexTradeTT 2 года назад

    Nice info but What about sound effect on click? Can you show that?

    • @ReneBalke
      @ReneBalke  2 года назад

      Check out the PlaySound function in the documentation ;)

    • @ForexTradeTT
      @ForexTradeTT 2 года назад

      @@ReneBalke I tried but was unsuccessful... Can I email you my file and you put it in? Or tell me how to thanks.

    • @ForexTradeTT
      @ForexTradeTT 2 года назад

      @@ReneBalke anyway to contact you bro?

  • @krispianwald3719
    @krispianwald3719 Год назад

    Hallo Rene, krasser deutscher Akzent aber sympatisch.. :D
    Ist es irgendwie möglich, dass die Positionen sofort gleichzeitig geschlossen werden und nicht nacheinander, was ja nach Menge leider einige Sekunden dauern kann... Also alle sofort geschlossen wäre für Scalping noch besser! Ist das einfach umzusetzen? Danke!

  • @MayYouLiveLongAndProsper
    @MayYouLiveLongAndProsper 11 месяцев назад

    How can I make the text ArielBold and wrap the text OR create a second line ?

    • @ReneBalke
      @ReneBalke  11 месяцев назад

      You can use ObjectSetString(,,OBJPROP_FONT,); to change the font. Second line is easiest to achieve with a second object.

  • @erickdavidosorioperez534
    @erickdavidosorioperez534 2 года назад

    Thanks for the tutorial, could you please create one on how to close partial positions?

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Hey, maybe I will do this in the future. It is really similar but you use the PositionClosePartial function :)

  • @andrewforrest7633
    @andrewforrest7633 2 года назад

    About the BUY & SELL button, i meant buttons that can be positioned anywhere on the screen such as above the running open positions bottom right !!! , MT5 market execution buttons are opposite side !!

  • @slawekgawlak8395
    @slawekgawlak8395 4 месяца назад

    Is it possible to display pnl in the button instead of "Close".

  • @johnd481
    @johnd481 Год назад

    Is there a way to have this "close all" as a hot key function rather than a button?

    • @ReneBalke
      @ReneBalke  Год назад

      Video for this will be on the channel in 2 hours ;)

  • @DoneFXCrypto
    @DoneFXCrypto 3 года назад

    Great video with good information, thank you very much

  • @ayva_shorts
    @ayva_shorts 2 года назад

    Hy. Wie kann ich eine Hot Key EA erstellen. Sodass ich zb. die Num-Tasten zuordnen kann. um Positionen zu managen. (Buy, Sell, Close 50% oder Stop Loss to Break Even. usw...)

    • @ReneBalke
      @ReneBalke  2 года назад

      Hey, das habe ich tatsächlich selber noch nicht gemacht. Aber ich meine mich zu erinnern, dass es dazu im mql5 Forum einige Beiträge gibt.

  • @DoneFXCrypto
    @DoneFXCrypto 3 года назад

    Please can you also do a video on how to program objects like S&R on HTF for signal confirmation, entry on STF plus even Fibonacci strategy for sniper entry on MT5

    • @ReneBalke
      @ReneBalke  3 года назад

      Hey, this would be kinda complex and time consuming implement. On RUclips I show the basics so you can understand the mql5 framework. Building complex EAs like this is in most cases time consuming but not really hard. So just go ahead and follow the tutorials and you will learn how to work with objects and stuff like that :)

  • @juliad.3516
    @juliad.3516 Год назад

    Hii, I was following your tutorial and everything was fine, but when I click my button, nothing happens. I got only info "The ButtonClose was clicked". Idk how to fix this, I watched the end of your video several times, but everything seems okay to me :(

  • @Kaxemian
    @Kaxemian 6 месяцев назад

    Thanks dear 🙏

  • @pitsotheartist3084
    @pitsotheartist3084 2 года назад

    Hy I'll like throw something on the suggestion box plis .... An EA that can open trades on multiple symbols once the signal appear on tht symbol while other trades are running.

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Hey, i put it on the list. But i cannot say if/when i will make a video about it. Maybe in the future :)

  • @PROPHETEMCHAUKE
    @PROPHETEMCHAUKE 3 года назад +1

    And also maybe add a button that opens multiple positions at the same price.

  • @samnthikadilrukshi3055
    @samnthikadilrukshi3055 Год назад

    Super ❤❤ ...

  • @rva3572
    @rva3572 2 года назад

    Would it be possible to create a button to close all profitable trades?

    • @ReneBalke
      @ReneBalke  2 года назад

      Yeah sure that is possible. You can simply modify this program and check if a trade is in profit.

  • @thabisothabzafxntshiliba4682
    @thabisothabzafxntshiliba4682 2 года назад

    i followed along with you but my button is not closing trades, what might be a problem?

    • @ReneBalke
      @ReneBalke  2 года назад

      Hey, that is hard to tell without seeing the code. Please double check if you copied everything correctly from the video. Also have a look at the Experts Journal of your mt5 and check for possible errors.

    • @thabisothabzafxntshiliba4682
      @thabisothabzafxntshiliba4682 2 года назад

      @@ReneBalke there is no way you can send the link of the button u made?

    • @ReneBalke
      @ReneBalke  2 года назад

      @@thabisothabzafxntshiliba4682 Hey, I cannot share the code if you are asking for that. I usually delete it after I finished the video recording..

    • @thabisothabzafxntshiliba4682
      @thabisothabzafxntshiliba4682 2 года назад

      @@ReneBalke ohk thanks

  • @MayYouLiveLongAndProsper
    @MayYouLiveLongAndProsper 11 месяцев назад

    I got there in the end BUT it would have been soooooooo much easier had you stuck to the original script (write a "Close All" button) rather than keep going off on tangents.
    ALSO, if you had left the comments IN for newbies like me. (it's not about how YOU would do it) (that comes later)
    Would have been nice if the final code was shown in it's entirety at the end ... THEN you could offer alternatives.
    I seemed to be forever going backwards and forwards looking for a specific line :(

    • @ReneBalke
      @ReneBalke  11 месяцев назад

      Thanks for the feedback! I really appreciate it. If you are searching for a detailed and structured course you will like my complete mql5 masterclass: en.bmtrading.de/mt5-masterclass/

  • @xHermek
    @xHermek 2 года назад

    Please tutorial for closed positive and negative.

  • @thabangismael1530
    @thabangismael1530 2 года назад

    Can you also please help on creating a password protected expert advisor. Example: to enter the password after dragging expert advisor on the chart. 🙏🙏

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Hey, that is really easy. You can just create a input string variable. Then in the OnInit function you will have to compare it to any string like
      if(InputString != "Password") ExpertRemove();

  • @Rezamovie21
    @Rezamovie21 3 года назад

    Excellent video

  • @PROPHETEMCHAUKE
    @PROPHETEMCHAUKE 2 года назад

    If possible one of the days kindly show us, how to write an expert advisor which uses 61.8% and 50% fibobacci level retracement to place entries. If possible one of the days.

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Fibos were requested frequently so I just recorded a video on this. It will be available tomorrow :)

    • @PROPHETEMCHAUKE
      @PROPHETEMCHAUKE 2 года назад +1

      Thank you very much Rene

  • @MayYouLiveLongAndProsper
    @MayYouLiveLongAndProsper 11 месяцев назад

    What you was saying "I don't bother with comments" ... You should be encouraging your students to keep them and even add their own until they become masters ... Even then there are an asset for anybody else who is less skilled but has to work on it

    • @ReneBalke
      @ReneBalke  11 месяцев назад

      Yeah right comments can be really useful :) Maybe I should use them more...

  • @andrewforrest7633
    @andrewforrest7633 2 года назад

    Fantastic channel, thanks for very much for the wonderful useful applications. Please do an application for BUY & SELL buttons with programmed lot values, so a $10 BUY Button (1lot) and a 0.1c Buy Button(0.1 lot), for scalping it will be amazing.

    • @ReneBalke
      @ReneBalke  2 года назад +1

      Thank you! :) I receive a lot of requestes lately and cannot handle all of them. That is why I always recommend to learn the basics. But maybe I can cover this in the future.

  • @autosassfx1934
    @autosassfx1934 2 года назад

    Please would this work in the strategy tester

    • @ReneBalke
      @ReneBalke  2 года назад

      Hey, by default the chart events do not trigger the event handler in the tester. But you can check the button state in the OnTick function and close positions if the button is closed. Do not forget to set the button state to false afterwards. ;)

    • @autosassfx1934
      @autosassfx1934 2 года назад +1

      @@ReneBalke thanks

  • @evelashell5096
    @evelashell5096 2 года назад

    i followed all of this to a T (i think) and when i click close nothing happens:( idk what i did wrong ?

  • @cienciaetecnologiaa
    @cienciaetecnologiaa 11 месяцев назад

    Great

  • @gsathian
    @gsathian 2 года назад

    Thank you for good vdo

  • @daprince6559
    @daprince6559 2 года назад

    the problem with your tutorials is that uyou dont share the codes from the tutorial which could be a very good reference point

    • @ReneBalke
      @ReneBalke  2 года назад

      Hey, I believe that you have the best learning effect if you write the code on your own. If you just copy and paste code from the internet you will never be able to write your own programs.

  • @tuan.nguyen1813
    @tuan.nguyen1813 Год назад +1

    You should not create excessively long videos; many people will feel reluctant to watch them. Instead, you should make shorter, concise videos and keep your narration minimal, focusing on what's necessary

  • @vincenzodimaro6045
    @vincenzodimaro6045 6 месяцев назад

    Great video but today there is chatgpt for these things

  • @iWaZziT
    @iWaZziT 11 месяцев назад

    fucking hell why do i have to watch a 43min tutorial just to get a simple button that should be included by default

  • @sultansarvaiya1664
    @sultansarvaiya1664 2 года назад