Announcement

Collapse
No announcement yet.

Ceasar2 signal

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Attached are ex4 and source of Ceasar2 Local Basket Closer ver 1.1 EA.

    EA checks (10 times a second and on each tick) for a drop in the total number of open trades, then closes the rest. Then recheckes all trades did close and recloses any stragglers. Any trade close errors are shown in Experts log.

    Can be run on your VPS or local laptop logged into the MT4 account ST is associated with.
    Attached Files
    Last edited by FxPhil; 09-14-2014, 04:40 AM.

    Comment


    • Originally posted by FxPhil View Post
      Attached are ex4 and source of Caesar2 Local Basket Closer ver 10.

      Code checks (10 times a second) for a drop in the total number of open trades and then closes the rest. Also recheckes that all trades did close and recloses any stragglers.
      Are you related to Dr Phil?

      Comment


      • Originally posted by FxPhil View Post
        Attached are ex4 and source of Ceasar2 Local Basket Closer ver 1.1 EA.

        EA checks (10 times a second and on each tick) for a drop in the total number of open trades, then closes the rest. Then recheckes all trades did close and recloses any stragglers. Any trade close errors are shown in Experts log.

        Can be run on your VPS or local laptop logged into the MT4 account ST is associated with.
        Presumably it closes all trades in your account? If you're following multiple signals, is there any way to only close trades with a particular comment?

        Comment


        • Originally posted by pearcey2 View Post
          Presumably it closes all trades in your account? If you're following multiple signals, is there any way to only close trades with a particular comment?
          EA closes all open trades when it detects the number of open trades has dropped. Uses OrdersTotal() to determine number of open trades.

          According to trade history, the magic number is the same as the numerical value of the comment field and changes for each order. Bummer that as can't tell which trade belongs to which account. If each signal source had a unique magic or comment then it could be done but would slow it down a lot as can't use changes in OrdersTotal() to detect 1st closed trade. Would need to continually search the trade log for changes in number of open trades per magic number or static comments.

          Would probably still be faster than ST controlled basket close. But ST would need to use a constant magic per signal provider, which is not the current situation.

          The following happens 10 times a second:

          if(OrdersTotal() > OpenTrades) // just opened another trade
          {
          OpenTrades = OrdersTotal(); // update Ea open trade count and exit
          return;
          }
          else
          if (OrdersTotal() < OpenTrades) // Number of open trades has dropped, so close the rest locally
          {
          if (OrdersTotal() == 0) // no trades open so exit
          {
          OpenTrades = 0;
          return;
          }

          CloseAllOpens(); // close all open trades
          OpenTrades = OrdersTotal(); // update Ea open trade count

          if(OrdersTotal() > 0) // some trades didn't close
          OpenTrades = OrdersTotal() + 1; // so setup to close them on next timer event

          return;
          }
          Last edited by FxPhil; 09-14-2014, 05:37 AM.

          Comment


          • St does not handshake every trade. Your ea works the same way st does so you won't see any improvement.

            As I wrote before

            Ea asks st server if trades should be closed
            If it says yes
            It now loops all trades and closes them
            Mt4 can't do this in parallel so one by one

            There is no increased load on our servers from orders closing... Load is constant depending on number of clients. Open/close is not a factor of load.

            Comment


            • Hi Will,

              The ST copier EA that sits on Tomas's account detects he has closed trades via drop in OrdersTotal() or another means?

              Does it then scan the open trades to find which trade was closed and then tell the slaves to close that order number? Isn't that why the magic of each trade is the same as the master trade so it is easy to find and close?

              Why would slave ST EA being asking St server if trades should be closed? That would be a lot of inward traffic coming from every slave EA. Surly slave EA sits and waits for ST server to tell it to either open or close a trade?

              To be clear if there were 2,000 clients closing a 10 trade basket, would the ST server network need to process 20,000 trade closes?
              Last edited by FxPhil; 09-14-2014, 06:04 AM.

              Comment


              • Generally lets say that Caesar has a basket of 20 trades - even he won't close all of them at the same time because he simply cant - so the master will probably take 5-6 seconds to close all 20 trades out.

                So the EA is going to get a round of 8-10 trades to close initially - which it will do in the same way you are saying - it doesn't do anything else but close out 8-10 tradse (or whatever its been told to do)

                Once the basket has closed, the EA will report the details back to ST network - and yes you are right in that there will be 20,000 in your example. However 20,000 queries is nothing Bare in mind you aren't talking about a single trade server here - ST runs on a server farm which has about 40 physical servers just for the trade copier.

                You will probably find that your code will execute the closure quicker than ST. There is pretty much no doubt in that - however on a large basket in high volatility, I expect you'll still find you end up getting queued at the broker end and still slipping.

                That being said, because your EA reacts on the first closure - on a really large basket where even the master is taking a few seconds to close, you will definatly get your close orders in before anyone else. It won't always work though, as this will only have any effect if the master itself is slow (which can happen dont' get me wrong). When you weigh up the pros and cons, its really not worth suggesting this as a viable solution, however I do believe as you understand your own process, that its a great idea to be running for yourself.

                Also - it scares me a little bit that you are suggesting people try this EA - when someone might not really know what its doing - in this case if you were running other signals, it'd go close those out. I get that you are helping, and thats awesome, but be aware that not everyone has a level of knowledge to understand what you are saying. Also so far Caesar has always closed all trades when a basket closes, but if that changes at all - you'll end up closing out trades that might not meant to close out.

                Comment


                • FXPhil - just one more thought - when you were saying that between each trade closure ST handshakes. I totally agree that if this was the case, on basket trades it would be a nightmare and cause excessive slow down (be it only a few hundred MS between trades) - but please bare in mind that it does NOT do this...

                  In a basket of 20 trades, it may handshakes once or twice if the master is taking a few seconds to close out, but in real terms that may only add 200-300ms to the total closure time (worst case). If on one of our VPS, its more likely to add 10-30ms...

                  Comment


                  • Hi Will,

                    Life is a learning exercise.

                    From the logs it appears the ST slave EA looks for closes trades every 90 sec while checking for opens every 30 sec?

                    15:36:00 Simpletrader-V3.1 GBPUSD,Monthly: Updating closed trades - Execution Time: 0ms
                    15:36:25 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449761.0]
                    15:36:55 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449791.0]
                    15:37:25 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449821.0]

                    15:37:31 Simpletrader-V3.1 GBPUSD,Monthly: Updating closed trades - Execution Time: 0ms
                    15:37:55 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449851.0]
                    15:38:25 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449881.0]
                    15:38:55 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449911.0]

                    15:39:02 Simpletrader-V3.1 GBPUSD,Monthly: Updating closed trades - Execution Time: 0ms
                    15:39:25 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449941.0]
                    15:39:55 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410449971.0]
                    15:40:25 Simpletrader-V3.1 GBPUSD,Monthly: Checking signal status [GMT:1410450001.0]

                    Have stated the Ceasar2Closer EA will close every open trade on the account, so those running other EAs or signals will not be able to use it.

                    Will post my results as they come it

                    Comment


                    • Hi Phil,

                      Checking signal status is getting the status of your signals on the account. This is only used for updating the writing about signal status on your chart. I.e. if its expired etc - It also checks which EA server you are connected to and things like that - it has no relevance on trade copying.

                      Updating closed trades simply runs every 90 seconds to sanity check that the latest closed trades were updated. The reason execution time is 0ms in your case is because there is nothing new to update (which is correct) - so no data is sent to the ST servers

                      Comment


                      • Originally posted by WillT View Post
                        Hi Phil,

                        Checking signal status is getting the status of your signals on the account. This is only used for updating the writing about signal status on your chart. I.e. if its expired etc - It also checks which EA server you are connected to and things like that - it has no relevance on trade copying.

                        Updating closed trades simply runs every 90 seconds to sanity check that the latest closed trades were updated. The reason execution time is 0ms in your case is because there is nothing new to update (which is correct) - so no data is sent to the ST servers
                        Ok understand.
                        Thanks

                        Comment


                        • Will could you also comment on if the slave EA will restore back to the original value a manually altered SL or TP?

                          Comment


                          • It would do if in the simpletrader settings you have that signal to copy tp/sl - just turn that off and it won't.

                            Comment


                            • Originally posted by WillT View Post
                              Generally lets say that Caesar has a basket of 20 trades - even he won't close all of them at the same time because he simply cant - so the master will probably take 5-6 seconds to close all 20 trades out ...
                              Will,

                              a question to the Caesar master. Is it running on MT4? If yes, would it make sense to move it to cTrader if the time is due for this? Perhaps the parallel execution option would speed up the master's trade closure and the ST copier would react some seconds earlier than it is doing now.
                              The master would be still ahead, but if "we" could save some seconds too in a fast moving market ...

                              Comment


                              • Originally posted by WillT View Post
                                It would do if in the simpletrader settings you have that signal to copy tp/sl - just turn that off and it won't.
                                For this signal the copy option is set to "set by provider" and I think you can't switch it off in this case, correct?

                                Comment

                                Working...
                                X