Desky. TDesk's trading drone.

Post Reply
goldcourse
Trader
Posts: 48
Joined: Tue Dec 27, 2011 2:18 am

Desky. TDesk's trading drone.

Post by goldcourse »

Vokin » Tue Nov 20, 2018 4:31 pm wrote:Hi Steve,
there is mismatch in basket sum in EA and account. See pict.
Maybe that's why EA closed the basket on a different TP than it was set up (It has happened to me twice).
Vokin,

You are still using V2.Try using V2d.
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 2e is in post 1, in response to this PM from tutank:
tutank wrote:HI, Great EA again :clap:

Can you check someofthecode

Code: Select all

if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
{
     SendBuyGrid(symbol, OP_BUYSTOP, ask + (DistanceFromMarket / factor), Lot );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                              
if (TypeOfGrid == OP_BUYLIMIT || TypeOfGrid == Both)
{
     SendBuyGrid(symbol, OP_BUYLIMIT, ask - (DistanceFromMarket / factor), Lot );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
Shouldn't it be...

Code: Select all

if (TypeOfGrid == Stop || TypeOfGrid == Both)
{
     SendBuyGrid(symbol, OP_BUYSTOP, ask + (DistanceFromMarket / factor), Lot );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                              
if (TypeOfGrid == Limit|| TypeOfGrid == Both)
{
       SendBuyGrid(symbol, OP_BUYLIMIT, ask - (DistanceFromMarket / factor), Lot );
}//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
You do not need the update if you are not grid trading.

DIYers, compare the first line in each block to see the change needing to be made. Repeat the exercise for the sell block.

Many thanks tutank. Hugely appreciated. :clap: :clap: :clap: :clap: :clap: :clap: :clap:

: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 »

DIYers, you might like to simply copy this over the top of the existing code, starting c. line 4532:

Code: Select all

      if (!StopTrading)
      {
         if (TimeCurrent() >= TimeToStartTrading[pairIndex])
         {
            if (OpenTrades == 0)
            {
               if (BuySignal || SellSignal)
               {
                  if (SendImmediateMarketTrade)
                  {
                     if (BuySignal)
                     {
                        result = LookForTradingOpportunities(symbol, pairIndex, OP_BUY);
                        if (UseGridTrading)
                           if (result)
                           {
                              if (TypeOfGrid == Stop || TypeOfGrid == Both)
                              {
                                 SendBuyGrid(symbol, OP_BUYSTOP, ask + (DistanceFromMarket / factor), Lot );
                              }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                              
                              if (TypeOfGrid == Limit || TypeOfGrid == Both)
                              {
                                 SendBuyGrid(symbol, OP_BUYLIMIT, ask - (DistanceFromMarket / factor), Lot );
                              }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                              
                           }//if (result)
                        
                     }//if (BuySignal)
                     
                     if (SellSignal)
                     {
                        result = LookForTradingOpportunities(symbol, pairIndex, OP_SELL);
                        if (UseGridTrading)
                           if (result)
                           {
                              if (TypeOfGrid == Stop || TypeOfGrid == Both)
                              {
                                 SendSellGrid(symbol, OP_SELLSTOP, bid - (DistanceFromMarket / factor), Lot );
                              }//if (TypeOfGrid == OP_SELLSTOP || TypeOfGrid == Both)
                              
                              if (TypeOfGrid == Limit || TypeOfGrid == Both)
                              {
                                 SendSellGrid(symbol, OP_SELLLIMIT, bid + (DistanceFromMarket / factor), Lot );
                              }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                              
                           }//if (result)
                        
                     }//if (SellSignal)
                     
                  }//if (SendImmediateMarketTrade)
                     
                  //This takes care of grid trading only.
                  if (!SendImmediateMarketTrade)
                     if (UseGridTrading)
                     {
                        if (BuySignal)
                        {
                           if (TypeOfGrid == Stop || TypeOfGrid == Both)
                           {
                              SendBuyGrid(symbol, OP_BUYSTOP, ask + (DistanceFromMarket / factor), Lot );
                           }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                                 
                           if (TypeOfGrid == Limit || TypeOfGrid == Both)
                           {
                              SendBuyGrid(symbol, OP_BUYLIMIT, ask - (DistanceFromMarket / factor), Lot );
                           }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                           
                        }//if (BuySignal)
                        
                        if (SellSignal)
                        {  
                           if (TypeOfGrid == Stop || TypeOfGrid == Both)
                           {
                              SendSellGrid(symbol, OP_SELLSTOP, bid - (DistanceFromMarket / factor), Lot );
                           }//if (TypeOfGrid == OP_SELLSTOP || TypeOfGrid == Both)
                           
                           if (TypeOfGrid == Limit || TypeOfGrid == Both)
                           {
                              SendSellGrid(symbol, OP_SELLLIMIT, bid + (DistanceFromMarket / factor), Lot );
                           }//if (TypeOfGrid == OP_BUYSTOP || TypeOfGrid == Both)
                        }//if (SellSignal)
                        
                     }//if (UseGridTrading)
                       
                     
               }//if (BuySignal || SellSignal)
               
            }//if (OpenTrades == 0)
            
         }//if (TimeCurrent() >= TimeToStartTrading[PairIndex])
      }//if (!StopTrading)
: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 »

Re the hedging thingy.

I had a few minutes to spare today. I entered a NUsd buy in the teeth of a sell signal. Desky immediately sent a sell hedge.

And ignored the pair of them from then on.

So it looks to me as though the hedge code is working just fine. For sure, it did here today. I am not surprised - it is simple code.

So folks, turn hedging back on and then work out what you are doing wrong instead of blaming my code for your failures, with all the concomitant risks to your membership here.

There is a huge difference between doing this and doing what tutank did at http://www.stevehopwoodforex.com/phpBB3 ... 24#p165024

tutank gained immediate promotion.

: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 »

V 2f is in post 1, with an idea I had yesterday. From the updated user guide's, "Trade exit strategies" section:
  • Margin level closure: this is for the basketeers and gridateers – I probably just invented two new words. Each new trade reduces our margin level percentage. The logical outcome of this is a margin call if the positions continue to move against us. “Shirt protection” is designed to keep us from ultimate disaster and I have described it later in this pdf. Margin level closure is intended to close every trade on the platform at a preset small profit once our margin level reaches an uncomfortable level. Bear in mind that this feature is indiscriminate and will close all trades regardless of their origin.
    • UseMarginLevelClosure: turns this feature on/off.
    • CloseBelowMarginLevel: the level you select as the time to bail on all your trades. Most brokers have a margin call at 100% to 125%. The default of 300% represents the level at which I would be decidedly twitchy – I do not like mine to drop below 1,000%.
    • AcceptableProfitCash: the cash profit to lock in when closing /deleting all trades. A zero value turns this off, so enter 0.01 as the nearest equivalent to zero. A negative figure represents an acceptable loss.
    • AcceptableProfitPips: the pips profit to lock in when closing /deleting all trades. A zero value turns this off, so enter 1 as the nearest equivalent to zero. A negative figure represents an acceptable loss.
No idea whether this will prove helpful or not. We shall see.

: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 » Sun Nov 25, 2018 11:44 pm wrote:V 2f is in post 1, with an idea I had yesterday. From the updated user guide's, "Trade exit strategies" section:
  • Margin level closure: this is for the basketeers and gridateers – I probably just invented two new words. Each new trade reduces our margin level percentage. The logical outcome of this is a margin call if the positions continue to move against us. “Shirt protection” is designed to keep us from ultimate disaster and I have described it later in this pdf. Margin level closure is intended to close every trade on the platform at a preset small profit once our margin level reaches an uncomfortable level. Bear in mind that this feature is indiscriminate and will close all trades regardless of their origin.
    • UseMarginLevelClosure: turns this feature on/off.
    • CloseBelowMarginLevel: the level you select as the time to bail on all your trades. Most brokers have a margin call at 100% to 125%. The default of 300% represents the level at which I would be decidedly twitchy – I do not like mine to drop below 1,000%.
    • AcceptableProfitCash: the cash profit to lock in when closing /deleting all trades. A zero value turns this off, so enter 0.01 as the nearest equivalent to zero. A negative figure represents an acceptable loss.
    • AcceptableProfitPips: the pips profit to lock in when closing /deleting all trades. A zero value turns this off, so enter 1 as the nearest equivalent to zero. A negative figure represents an acceptable loss.
No idea whether this will prove helpful or not. We shall see.

:xm: :rocket:
Steve, TDesk Trading Partner EA v2f experiencing zero divide error, Could not launch it but it can compiled. See error log:

Compiling 'TDesk Trading Partner EA'
0 18:43:58.687 TDesk Trading Partner EA XAUUSD,H1: uninit reason 2
0 18:43:58.692 Expert TDesk Trading Partner EA XAUUSD,H1: removed
0 18:43:58.729 Expert TDesk Trading Partner EA XAUUSD,H1: loaded successfully
0 18:43:58.869 TDesk Trading Partner EA XAUUSD,H1: SecureSetTimer, attempt=1, error=0
1 18:43:58.869 TDesk Trading Partner EA XAUUSD,H1: zero divide in 'TDesk Trading Partner EA.mq4' (2567,50)
3 18:43:58.870 TDesk Trading Partner EA XAUUSD,H1: not initialized
0 18:43:58.870 TDesk Trading Partner EA XAUUSD,H1: uninit reason 8
0 18:43:58.875 Expert TDesk Trading Partner EA XAUUSD,H1: removed

Whether anybody experiencing this error or not!

taipan..
Last edited by taipan on Tue Nov 27, 2018 11:22 am, edited 1 time in total.
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 Nov 27, 2018 11:02 am wrote:
Steve, TDesk Trading Partner EA v2f experiencing zero divide error, Could not launch it. See error log:

Compiling 'TDesk Trading Partner EA'
0 18:43:58.687 TDesk Trading Partner EA XAUUSD,H1: uninit reason 2
0 18:43:58.692 Expert TDesk Trading Partner EA XAUUSD,H1: removed
0 18:43:58.729 Expert TDesk Trading Partner EA XAUUSD,H1: loaded successfully
0 18:43:58.869 TDesk Trading Partner EA XAUUSD,H1: SecureSetTimer, attempt=1, error=0
1 18:43:58.869 TDesk Trading Partner EA XAUUSD,H1: zero divide in 'TDesk Trading Partner EA.mq4' (2567,50)
3 18:43:58.870 TDesk Trading Partner EA XAUUSD,H1: not initialized
0 18:43:58.870 TDesk Trading Partner EA XAUUSD,H1: uninit reason 8
0 18:43:58.875 Expert TDesk Trading Partner EA XAUUSD,H1: removed

Whether anybody experiencing this error or not!

taipan..
Thanks Taipan.

AccountMargin() = 0 if there are no market trades open, hence the error. I should have thought of that.

The fix is in post 1. DIYers, go to bool MarginPercentClosure() and insert this at the top of the function:

Code: Select all

   //No trades open
   if (OrdersTotal() == 0)
      return(false);
: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 » Tue Nov 27, 2018 7:16 pm wrote:
Thanks Taipan.

AccountMargin() = 0 if there are no market trades open, hence the error. I should have thought of that.

The fix is in post 1. DIYers, go to bool MarginPercentClosure() and insert this at the top of the function:

Code: Select all

   //No trades open
   if (OrdersTotal() == 0)
      return(false);
:xm: :rocket:
That was fast. Thank you very much.

taipan
User avatar
Wavegarrick
Trader
Posts: 1172
Joined: Sun Dec 30, 2012 11:21 am
Location: South Africa

Desky. TDesk's trading drone.

Post by Wavegarrick »

Hi Steve,

Thanks for your endless work on this Ea :good: The hedging feature working just fine. This has also given me more ideas. Will share soon.

Cheers
Leon
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 »

Wavegarrick » Tue Nov 27, 2018 5:03 pm wrote:Hi Steve,

Thanks for your endless work on this Ea :good: The hedging feature working just fine. This has also given me more ideas. Will share soon.

Cheers
Leon
It is a pleasure Leon. Harnessing the power of an EA drone to TDesk makes quite some combo.

: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.
Post Reply

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