stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Desky. TDesk's trading drone.
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5545
Page 13 of 50
Author:  goldcourse [ Tue Nov 20, 2018 12:58 pm ]
Post subject:  Desky. TDesk's trading drone.

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.
Author:  SteveHopwood [ Thu Nov 22, 2018 8:29 pm ]
Post subject:  Desky. TDesk's trading drone.

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:
Author:  SteveHopwood [ Thu Nov 22, 2018 8:35 pm ]
Post subject:  Desky. TDesk's trading drone.

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:
Author:  SteveHopwood [ Sat Nov 24, 2018 12:55 am ]
Post subject:  Desky. TDesk's trading drone.

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:
Author:  SteveHopwood [ Sun Nov 25, 2018 3:44 pm ]
Post subject:  Desky. TDesk's trading drone.

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:
Author:  taipan [ Tue Nov 27, 2018 11:02 am ]
Post subject:  Desky. TDesk's trading drone.

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..
Author:  SteveHopwood [ Tue Nov 27, 2018 11:16 am ]
Post subject:  Desky. TDesk's trading drone.

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:
Author:  taipan [ Tue Nov 27, 2018 11:52 am ]
Post subject:  Desky. TDesk's trading drone.

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
Author:  Wavegarrick [ Tue Nov 27, 2018 5:03 pm ]
Post subject:  Desky. TDesk's trading drone.

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
Author:  SteveHopwood [ Tue Nov 27, 2018 6:34 pm ]
Post subject:  Desky. TDesk's trading drone.

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:
All times are UTC Page 13 of 50