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

Hopelessly confused by TDesk or Desky? Ask here.
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5546
Page 55 of 71
Author:  freakyg415 [ Fri Apr 23, 2021 1:30 am ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

All praises to you Thomas. Moving the drones to the another chart did the trick :yahoo: :!!: . Thanks a million brother.

V/r,
Osito 8-)
Author:  orso [ Thu Apr 29, 2021 5:32 pm ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

Hi,

I have a question about hedging....


In order to reduce drawdown with SPB i use hedge function in Desky.
Basically i use SS opposite signal to generate hedge trade.
Now I have this problem: when Desky hedges a basket of trades or a single trade it opens a hedge trade with same lot size of each of them. But if SPB recovers with new position and then market continues to go against my original trade, Desky does not hedge the new position, leaving the basket unbalanced.
Maybe Desky does not hedges (increment hedged lot size) when a hedged trade is already present?
How can i resolve that?

I tried to find something in Desky guide but nothing….
I hope I was clear and didn't ask a stupid question.

Thanks
Author:  SteveHopwood [ Thu Apr 29, 2021 6:35 pm ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

orso » Thu Apr 29, 2021 5:32 pm wrote:Hi,

I have a question about hedging....


In order to reduce drawdown with SPB i use hedge function in Desky.
Basically i use SS opposite signal to generate hedge trade.
Now I have this problem: when Desky hedges a basket of trades or a single trade it opens a hedge trade with same lot size of each of them. But if SPB recovers with new position and then market continues to go against my original trade, Desky does not hedge the new position, leaving the basket unbalanced.
Maybe Desky does not hedges (increment hedged lot size) when a hedged trade is already present?
How can i resolve that?

I tried to find something in Desky guide but nothing….
I hope I was clear and didn't ask a stupid question.

Thanks
You are using an EA that trades one set of signals to hedge trades placed by an EA responding to a different set of signals?

Sounds bonkers to me.

:xm: :rocket:
Author:  orso [ Fri Apr 30, 2021 9:20 pm ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

I am obliged to use tdesk because you have introduced self-closing of trade hedged on the opposite signal in MPTM.
Furthermore, MPTM does not allow you to selectively manage hedged trades as they all have a different order comment (ticket) unlike those created by Desky and this is a problem in my way of trading.
Dear Steve what I'm telling you, it works, I can prove it, and it also has a rationale.
I posted below the results of the last 2 weeks of one of the many systems I am testing with this configuration.
However, in order not to go off-topic, I ask if the problem that Desky is unable to add hedging trades can be solved.
Thank you]
Author:  SteveHopwood [ Sat May 01, 2021 1:11 am ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

orso » Fri Apr 30, 2021 9:20 pm wrote:I am obliged to use tdesk because you have introduced self-closing of trade hedged on the opposite signal in MPTM.
Furthermore, MPTM does not allow you to selectively manage hedged trades as they all have a different order comment (ticket) unlike those created by Desky and this is a problem in my way of trading.
Dear Steve what I'm telling you, it works, I can prove it, and it also has a rationale.
I posted below the results of the last 2 weeks of one of the many systems I am testing with this configuration.
However, in order not to go off-topic, I ask if the problem that Desky is unable to add hedging trades can be solved.
Thank you]
No.
Author:  ManyanaMan [ Tue May 04, 2021 1:50 am ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

Hi Traders,
I am completely new to Tdesk / Desky, i have spent hours reading the various threads / manuals which has given me some understanding but resulting in as many questions as the threads i have read.

I am looking for a mentor that i can direct message to help me with my first build of Tdesk, this is to eliminate any frustration in the forum as i will have many noob questions and hopefully after my first build i will have a complete understanding of Tdesk / Desky.

I am willing to pay for the service if someone can offer me assistance and to show my appreciation for the work that has been provided for free i have donated $100GBP to Tommaso.

Steve sorry i did not mark my donation as “Donation for Tommaso” but marked from ManyanaMan.

Kind Regards
David McDonald
Author:  freakyg415 [ Tue May 04, 2021 4:59 am ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

Big Pippin to All,

First, I would like to pay the most respect to all the (what I consider) master coders in this forum as this endeavor is difficult and tedious. Tdesk, Desky, MPTM, APTM amongst others are truly impressive. I couldn't fathom writing upwards of 9000 lines of code. Hell I still struggle with my little baby edits :lol: .

I have been dabbling here and there and usually find indicators/experts I like and successfully editing them by adding options or features that I want. I have successfully done this with your MPTM and am now trying to do it with Desky. I was trying to add a Timeframe selections and Multiplier to the ATR for the Differential Lot size option. I have added the options and what I thought was the correct code. Compiled it and recieved 0 warnings, 0 errors, and and all good from the metaeditor however, once I got it onto the chart, It would successfully load and then successfully remove itself :arrrg: . So from there I thought I would keep it basic and could just change out a few bolts under the hood and get Desky to do what I wanted. So I went under and changed the ATR period from D1 to H1 the multiplier to 1.5. I compiled it again and received no issues. I threw it on the chart, and it stayed :clap: . I thought I was good to go but when it was time to enter a trade I got punched in the face with the error message you see below :arrrg: . Can anyone give any advice on moving forward with this? I don't really know where to look because the metaeditor is giving the green light :arrrg: .

Code: Select all

double getDifferentialLotSize(string symbol)
{

   //Returns a lot size that will ensure that pips movements will
   //generate equal profits/losses across all pairs.
   //This is a hack of Rene' code at http://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=167116#p167116 - no 
   //idea how he came up with the calculation.
   //Thanks Rene. You are a star as well as a genius.
   
   lotSizeMultiplier = 1.5;
   
   double lotSize = Lot;
   double dailyATR = 0;
   string atrSymbol = "";
   
   int    numATR = 0;
   double totalATRProfit = 0.0;

   //calculate the average daily ATR of all pairs
   for (int pairIndex = 0; pairIndex < ArraySize(TDeskSymbols); pairIndex++)
   {
      atrSymbol = TDeskSymbols[pairIndex];
      getBasics(atrSymbol);//We need factor
      
      dailyATR = iATR( atrSymbol, PERIOD_H1, AtrPeriod, 1 );
      if ( !closeEnough(dailyATR, 0 ) )// Only add to totalATRProfit if dailyATR > 0.0
      {                   
         totalATRProfit += dailyATR * factor * MarketInfo( atrSymbol, MODE_TICKVALUE );
         numATR++;
      }//if ( !closeEnough(dailyATR, 0 )
   }//for (int pairIndex = 0; pairIndex < ArraySize(TDeskSymbols); pairIndex++) 
   
   //calculate the lot size multiplier. 
   if ( numATR > 0 ) 
   {
      getBasics(symbol);
      dailyATR = iATR( symbol, PERIOD_H1, AtrPeriod, 1 );
      double averageATR = totalATRProfit / numATR;
      if ( !closeEnough(dailyATR, 0 ) )
            lotSizeMultiplier = averageATR / ( dailyATR * factor * MarketInfo( symbol, MODE_TICKVALUE ) );

   }//if ( numATR > 0 )   
Also, I don't know if anyone else has run into this issue, but I downloaded a fresh set of Built in Indicator Parameters files from the forum and whenever, I put in an input for Builtin_Functn_3 I would get an error message and the ex4 file would delete due to the compile error in metaeditor. I couldn't see any difference in between Builtin_Functn_3 and the others so in order to bypass the error I moved to Builtin_Functn_4 and haven't had any issues since.

Code: Select all

#define Builtin_Functn_1 iMA
#define Builtin_Params_1 1,0,MODE_EMA,PRICE_CLOSE

#define Builtin_Functn_2 iMA
#define Builtin_Params_2 240,0,MODE_EMA,PRICE_CLOSE

#define Builtin_Functn_3 iDummy
#define Builtin_Params_3 0,0,0

#define Builtin_Functn_4 iMA
#define Builtin_Params_4 240,1,MODE_EMA,PRICE_CLOSE

double GetBuiltin_1 (string symbol, ENUM_TIMEFRAMES timeframe, int shift) export
{
   #ifdef Builtin_Params_1
      return(Builtin_Functn_1(symbol,timeframe,Builtin_Params_1,shift));
   #else
      return(Builtin_Functn_1(symbol,timeframe,shift));
   #endif
}

double GetBuiltin_2 (string symbol, ENUM_TIMEFRAMES timeframe, int shift) export
{
   #ifdef Builtin_Params_2
      return(Builtin_Functn_2(symbol,timeframe,Builtin_Params_2,shift));
   #else
      return(Builtin_Functn_2(symbol,timeframe,shift));
   #endif
}

double GetBuiltin_3 (string symbol, ENUM_TIMEFRAMES timeframe, int shift) export
{
   #ifdef Builtin_Params_3
      return(Builtin_Functn_3(symbol,timeframe,Builtin_Params_3,shift));
   #else
      return(Builtin_Functn_3(symbol,timeframe,shift));
   #endif
}
All in all, What a learning experience and a huge slice of humble pie this journey into trading and coding has been thus far. I look forward to the future. Best of luck to all. Stay Green.

V/r
Osito 8-)
Author:  SteveHopwood [ Tue May 04, 2021 2:51 pm ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

freakyg415 » Tue May 04, 2021 4:59 am wrote:I was trying to add a Timeframe selections and Multiplier to the ATR for the Differential Lot size option. I have added the options and what I thought was the correct code. Compiled it and recieved 0 warnings, 0 errors, and and all good from the metaeditor however, once I got it onto the chart, It would successfully load and then successfully remove itself :arrrg: .
Check the Experts and Journal tabs when something like this happens. These sometimes reveal the nature of the problem. A divide by zero stops an EA but does not remove it from the chart, so it looks as though it is still working.

An array out of range error removes the EA, so you do at least then know there is a problem.
So from there I thought I would keep it basic and could just change out a few bolts under the hood and get Desky to do what I wanted. So I went under and changed the ATR period from D1 to H1 the multiplier to 1.5. I compiled it again and received no issues. I threw it on the chart, and it stayed :clap: . I thought I was good to go but when it was time to enter a trade I got punched in the face with the error message you see below :arrrg: . Can anyone give any advice on moving forward with this? I don't really know where to look because the metaeditor is giving the green light :arrrg: .
I use Alerts to show me what is going on. Underneath

Code: Select all

if ( !closeEnough(dailyATR, 0 ) )
            lotSizeMultiplier = averageATR / ( dailyATR * factor * MarketInfo( symbol, MODE_TICKVALUE ) );
Add this:
Alert(lotSizeMultiplier);

Find out what is happening when Desky tries to send an order. Do a search for this line of code:
Alert(symbol," ",WindowExpertName()," ",stype," order send failed with error(",err,"): ",ErrorDescription(err));
This takes you to the code block that deals with an order send failure. Insert this underneath:

Code: Select all

         Alert(symbol," ",stype,": price ", DoubleToString(price, digits), ": Lot ", lotsize, ": TP ", DoubleToString(take, digits),
               ": SL ", DoubleToString(stop, digits) );   
You can work out which element is causing the problem.

:xm: :rocket:
Author:  freakyg415 [ Wed May 05, 2021 1:00 am ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

Many thanks Steve, I'll give her a go.

V/r
Osito 8-)
Author:  freakyg415 [ Wed May 05, 2021 12:54 pm ]
Post subject:  Hopelessly confused by TDesk or Desky? Ask here.

Many thanks Steve,

:youknow: I gave her a go and it worked like a charm. The error in the Experts tab reports that there is an "invalid lot amount for the send order function" and the alert below shows that the lot size is 0.0; that's when it hit me. I went under the hood to verify and I saw that the lot size is based off of the "Hard lot sizing" setting. Unless I am off in my logic.

Code: Select all

extern string  hls="-- 'Hard' lot sizing --";
extern double  Lot=0.1;

Code: Select all

   double lotSize = Lot;
The goal is to get the risk percent setting into the mix so that desky will take the desired risk percent, ATR period and multiplier, conduct the math to come up with the proper lot size and stop level, and enter the trade apropriately. In the manual it says that "You can use this feature (Differential Lot Sizing) in conjunction with account size lot sizing." I interpreted that to include the risk percentage I guess. Regardless I know this is possible but it looks like this is a bit more than a bolt change out under the hood :lol: , this baby needs a new set of headers to get where I'm trying to go. I'm a bit lost on how to calculate my desired effect but I'm in this for the long haul.

Stay green gents.


V/r
Osito 8-)
All times are UTC Page 55 of 71