Desky. TDesk's trading drone.

Post Reply
User avatar
Sojourner
Trader
Posts: 105
Joined: Fri Apr 27, 2012 7:36 pm

Desky. TDesk's trading drone.

Post by Sojourner »

zoltankiss » Wed Dec 12, 2018 7:34 am wrote:
SteveHopwood » Wed Dec 12, 2018 3:43 am wrote:A question for our friends in the US.

Are you folks able to use Desky's grid trading feature, combined with basket trading? If not, would someone explain the FIFO rules in detail so I can do something about it.

:xm: :rocket:
Steve,

Attached the .pdf with a great explanation of FIFO.

I'm not using the grid yet, still fighting to find an acceptable money management for Desky, but it's a bit hard with all these non-sense rules in the US (no hedge, FIFO, usual high spread (average 2-5 pips))

Thank you,

Zolie
I might add to that PDF information on FIFO that FIFO (thanks to DODD-FRANK..bastards) now will not even allow a second order to be placed on an instrument if the first one has a TP or SL !
There is other stuff too:
https://oanda.secure.force.com/AnswersS ... YifQ%3D%3D

This make it tougher on us in the USA. Some EAs won't even work for us now and I'm not talking just hedge ones.

I noticed that sometimes the 'close all' scripts won't work either because FIFO wants multiple trades on one instrument to be closed in the order that they were created. I've ended up having to close TDesk/Desky trades manually sometimes because nuke option flags a FIFO violation. Ugh.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Desky. TDesk's trading drone.

Post by SteveHopwood »

taipan » Tue Sep 24, 2019 1:01 am wrote:Hi Steve,

There is a lot repeating Opening and delete log when "DeletePendingOrdersOnFlatSignal is set to true".


taipan
I have found one possible cause and have posted an attempted fix in post 1.

To DIY, do a search for: fillTheGap(symbol);
Insert this immediately above:
if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)//Either the user does not want pendings deleted on a flat signal, or the signal is not FLAT

I have added some explanatory comments to the code block, which reads:

Code: Select all

      //There is no hedge in place and trading is not stopped.
      //Is there a gap to fill?
      if (openTrades > 0)//No trades means no gaps.
         if (FillTheGaps)//The user wants gaps filling
            if (!hedged)//but not when the position is hedged.
               if (!StopTrading)//User wants to continue trading.
                  if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)//Either the user does not want pendings deleted on a flat signal, or the signal is not FLAT
                     fillTheGap(symbol);//Looks for a gap to fill.
  
:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

Desky. TDesk's trading drone.

Post by taipan »

SteveHopwood » Wed Sep 25, 2019 12:58 am wrote:
taipan » Tue Sep 24, 2019 1:01 am wrote:Hi Steve,

There is a lot repeating Opening and delete log when "DeletePendingOrdersOnFlatSignal is set to true".


taipan
I have found one possible cause and have posted an attempted fix in post 1.

To DIY, do a search for: fillTheGap(symbol);
Insert this immediately above:
if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)//Either the user does not want pendings deleted on a flat signal, or the signal is not FLAT

I have added some explanatory comments to the code block, which reads:

Code: Select all

      //There is no hedge in place and trading is not stopped.
      //Is there a gap to fill?
      if (openTrades > 0)//No trades means no gaps.
         if (FillTheGaps)//The user wants gaps filling
            if (!hedged)//but not when the position is hedged.
               if (!StopTrading)//User wants to continue trading.
                  if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)//Either the user does not want pendings deleted on a flat signal, or the signal is not FLAT
                     fillTheGap(symbol);//Looks for a gap to fill.
  
:xm: :rocket:

Thanks Steve for fixing this small errors. Appreciated very much.

taipan
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Desky. TDesk's trading drone.

Post by SteveHopwood »

V 3u is in post 1.

I do not fully understand mastercool's post here http://www.stevehopwoodforex.com/phpBB3 ... 56#p168756 but this sort of post always sends me to look at the code in case I have missed something.

I have missed an entire function, so none of the Friday/Saturday close all inputs would have any effect. I have no idea if this is the cause of mastercool's problem, but it is better to have functions that I describe in the user guide actually available. :arrrg:

DIYers and code checkers, a teensy bit of housekeeping first. Do a search and replace for FridaycloseAllHour, replacing it with FridayCloseAllHour. Repeat this process with SaturdaycloseAllHour.

Copy this function wherever you want it to go. I always add new functions immediately above OnTick(), but that is just me:

Code: Select all

void shutDownForTheWeekend()
{

   //Close/delete all trades to be flat for the weekend.
   
   int day = TimeDayOfWeek(TimeLocal() );
   int hour = TimeHour(TimeLocal() );
   bool CloseDelete = false;
   
   //Friday
   if (day == 5)
   {
      if (hour >= FridayCloseAllHour)
         if (totalCashUpl >= MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
            CloseDelete = true;
   }//if (day == 5)
 
   //Saturday
   if (day == 6)
   {
      if (hour >= SaturdayCloseAllHour)
         if (totalCashUpl >= MaxAllowableCashLoss)//MaxAllowableCashLoss is a negative number
            CloseDelete = true;
   }//if (day == 6)
   
   if (CloseDelete)
   {
      closeAllTrades(allSymbols, allTrades);
      if (forceTradeClosure)
         closeAllTrades(allSymbols, allTrades);
      if (forceTradeClosure)
         closeAllTrades(allSymbols, allTrades);
   }//if (CloseDelete)
      

}//End void shutDownForTheWeekend()
Then go to void OnTimer(). Scroll down to/search for: }//if (haveWeReachedOurTarget(PERIOD_D1) )

Copy this code block underneath:

Code: Select all

   //Can we shut down for the weekend?
   int d = TimeDayOfWeek(TimeLocal() );
   if (d > 4)//Thursday = 4
   { 
      if (OrdersTotal() > 0)
      {
         countTradesForGlobalBasket();
         if (globalTradesTotal > 0)
         {
            shutDownForTheWeekend();
            if (forceTradeClosure)
               closeAllTrades(allSymbols, allTrades);
            if (forceTradeClosure)
               closeAllTrades(allSymbols, allTrades);
         }//if (globalTradesTotal > 0)
      }//if (OrdersTotal() > 0)
   }//if (d > 4)
      
:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Desky. TDesk's trading drone.

Post by SteveHopwood »

Sojourner » Tue Sep 24, 2019 4:43 pm wrote: I noticed that sometimes the 'close all' scripts won't work either because FIFO wants multiple trades on one instrument to be closed in the order that they were created. I've ended up having to close TDesk/Desky trades manually sometimes because nuke option flags a FIFO violation. Ugh.
Try the updated nuclear option script from post 1. This stores the ticket numbers of all the trades with the appropriate number in an array, and the attempts to close them in the order in which they were placed.

The closure is a 2 pass process, closing the market orders first and then deleting stop/limit orders. Sing out if this does not work.

Does your problem apply to the, "Close all trades this pair only script.mq4" script as well?

:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

Desky. TDesk's trading drone.

Post by taipan »

taipan » Wed Sep 25, 2019 9:16 am wrote:
SteveHopwood » Wed Sep 25, 2019 12:58 am wrote:
taipan » Tue Sep 24, 2019 1:01 am wrote:Hi Steve,

There is a lot repeating Opening and delete log when "DeletePendingOrdersOnFlatSignal is set to true".


taipan
I have found one possible cause and have posted an attempted fix in post 1.

To DIY, do a search for: fillTheGap(symbol);
Insert this immediately above:
if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)//Either the user does not want pendings deleted on a flat signal, or the signal is not FLAT

I have added some explanatory comments to the code block, which reads:

Code: Select all

      //There is no hedge in place and trading is not stopped.
      //Is there a gap to fill?
      if (openTrades > 0)//No trades means no gaps.
         if (FillTheGaps)//The user wants gaps filling
            if (!hedged)//but not when the position is hedged.
               if (!StopTrading)//User wants to continue trading.
                  if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)//Either the user does not want pendings deleted on a flat signal, or the signal is not FLAT
                     fillTheGap(symbol);//Looks for a gap to fill.
  
:xm: :rocket:

Thanks Steve for fixing this small errors. Appreciated very much.

taipan

Hi Steve,
Now the problem resurfaced again few hours ago, same expert log occurred. Please investigage what causes these errors. Now even I turned off "DeletePendingOrdersOnFlatSignal", the Open and Delete events keep on coming. I had update Desky to the latest version v3u. I have now to turn off the following parameters to false:
DeletePendingOrdersOnFlatSignal=true
DeletePendingOrdersOnOppositeSignal=true
DeletePendingOrdersOnEXITSignal=true

then the errors stopped.
taipan
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Desky. TDesk's trading drone.

Post by SteveHopwood »

taipan » Wed Sep 25, 2019 12:13 pm wrote:
Hi Steve,
Now the problem resurfaced again few hours ago, same expert log occurred. Please investigage what causes these errors. Now even I turned off "DeletePendingOrdersOnFlatSignal", the Open and Delete events keep on coming. I had update Desky to the latest version v3u. I have now to turn off the following parameters to false:
DeletePendingOrdersOnFlatSignal=true
DeletePendingOrdersOnOppositeSignal=true
DeletePendingOrdersOnEXITSignal=true

then the errors stopped.
taipan
I haven't the faintest idea what is causing this. Could you post a setfile please, so I can see what all your inputs are. This might help me track down the fault.

:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

Desky. TDesk's trading drone.

Post by taipan »

SteveHopwood » Wed Sep 25, 2019 8:33 pm wrote:
taipan » Wed Sep 25, 2019 12:13 pm wrote:
Hi Steve,
Now the problem resurfaced again few hours ago, same expert log occurred. Please investigage what causes these errors. Now even I turned off "DeletePendingOrdersOnFlatSignal", the Open and Delete events keep on coming. I had update Desky to the latest version v3u. I have now to turn off the following parameters to false:
DeletePendingOrdersOnFlatSignal=true
DeletePendingOrdersOnOppositeSignal=true
DeletePendingOrdersOnEXITSignal=true

then the errors stopped.
taipan
I haven't the faintest idea what is causing this. Could you post a setfile please, so I can see what all your inputs are. This might help me track down the fault.

:xm: :rocket:

Here you go:
TDesk Desky TradingPartner EA v3u -25092019.set
You do not have the required permissions to view the files attached to this post.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Desky. TDesk's trading drone.

Post by SteveHopwood »

I am thrashing around in the dark here. It is just like the ole days. :arrrg: :arrrg: :arrrg:

I have added a bit more code, in hope rather than faith. Post 1 as usual.

I have added some code to: void canWeSendTrades(string symbol, int pairIndex, int signal)

Scroll down to: getBasics(symbol); Insert this just above:

Code: Select all

   //Just in case a buy/sell signal has been left when it should have been cancelled
   //and the signal has changed to untradable.
   if (signal == FLAT || signal == NONE)
      return;
 
I have added an extra check to the line of code I added earlier. Do a search for: if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)

Edit to include an extra check:
if (!DeletePendingOrdersOnFlatSignal || (signal != FLAT && signal != NONE))

No idea if it will work.

:xm: :rocket:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
taipan
Trader
Posts: 355
Joined: Sat Feb 16, 2013 11:27 am

Desky. TDesk's trading drone.

Post by taipan »

SteveHopwood » Wed Sep 25, 2019 11:00 pm wrote:
I am thrashing around in the dark here. It is just like the ole days. :arrrg: :arrrg: :arrrg:

I have added a bit more code, in hope rather than faith. Post 1 as usual.

I have added some code to: void canWeSendTrades(string symbol, int pairIndex, int signal)

Scroll down to: getBasics(symbol); Insert this just above:

Code: Select all

   //Just in case a buy/sell signal has been left when it should have been cancelled
   //and the signal has changed to untradable.
   if (signal == FLAT || signal == NONE)
      return;
 
I have added an extra check to the line of code I added earlier. Do a search for: if (!DeletePendingOrdersOnFlatSignal || signal != FLAT)

Edit to include an extra check:
if (!DeletePendingOrdersOnFlatSignal || (signal != FLAT && signal != NONE))

No idea if it will work.

:xm: :rocket:

Hi Steve,
After upated with the latest Desky, the problems still happened but not that frequent anymore. I can live with that as long as the expert log does not occurred so freqent that will not causing the GP Demo got deleted.

Thanks for the bug hunting.

taipan
Post Reply

Return to “TDesk: A Thomas Special. The greatest trading tool ever.”