Desky. TDesk's trading drone.

Post Reply
User avatar
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Desky. TDesk's trading drone.

Post by tomele »

SteveHopwood » 19 Nov 2019, 01:14 wrote:What Thomas wants is what he gets.
You can't explain this to my wife, can you? :smile: :smile: :smile:

Jokes aside, we should work on something similar when it comes to news events.

Cheers
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
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 »

tomele » Mon Nov 18, 2019 11:19 pm wrote:
You can't explain this to my wife, can you? :smile: :smile: :smile:
Don't expect any greater success on my behalf than you have already enjoyed. I will try my best mind. :lol:
Jokes aside, we should work on something similar when it comes to news events.

Cheers
Maybe one day, but I will take some convincing that they are worth taking notice of. I stopped taking notice of them a long time ago.

In the meantime, Renes' EA communicates with all my EA's and deals with news events rather well. Sing out if I have missed out something vital in Desky that means he does not communicate with Rene's EA (http://www.stevehopwoodforex.com/phpBB3 ... 30#p150930)

: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
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Desky. TDesk's trading drone.

Post by renexxxx »

SteveHopwood » Tue Nov 19, 2019 10:50 am wrote: In the meantime, Renes' EA communicates with all my EA's and deals with news events rather well. Sing out if I have missed out something vital in Desky that means he does not communicate with Rene's EA (http://www.stevehopwoodforex.com/phpBB3 ... 30#p150930)
Another way to deal with this problem, is by not sending the trade with a hard SL and TP, but doing this (trade closing) logic in the OnTick() handler. You can then check the spread and only do what you need to do if spread does not exceed a certain MaxSpread parameter. I know that this is much more work, especially in a Multi-Symbol EA, but it would also protect the trade if the spread widens outside rollover time.

Anyway, ignore my ramblings if this is totally besides the point.
User avatar
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Desky. TDesk's trading drone.

Post by tomele »

TDeskSignals.mqh provides much more information than only the signals found in the TDeskSignals[] array. Altogether there are eight arrays holding information for each symbol. Of particualr interest for this discussion are the following two:

TDeskSpreads[]
TDesk has an algorithm for detecting unusual spreads, which can be configured by the user. In TDesk, new signals are blocked if this function is enabled and unusual spreads are detected. This state is then signaled to Desky via the TDeskSpreads[] array. The values are of TDESKSPREADS enum type: NORMAL, ABNORMAL, STOPHUNT. If the state for a symbol is other than NORMAL, Desky's stop orders are at risk. The two other states have informational character and don't need to be evaluated.

TDeskNews[]
TDesk also has an algorithm for detecting news events, which can be configured by the user. It is based on René's library. In TDesk, new signals are blocked for a certain time before and (optional) after news events if this function is enabled. This state is then signaled to Desky via the TDeskNews[] array. The values are of TDESKNEWS enum type: NONEWS, LOWNEWS, MEDIUMNEWS, HIGHNEWS. If the state for a symbol is other than NONEWS, Desky's stop orders are at risk. The three other states have informational character and don't need to be evaluated.

Cheers
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
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 »

tomele » Tue Nov 19, 2019 10:05 am wrote:TDeskSignals.mqh provides much more information than only the signals found in the TDeskSignals[] array. Altogether there are eight arrays holding information for each symbol. Of particualr interest for this discussion are the following two:

TDeskSpreads[]
TDesk has an algorithm for detecting unusual spreads, which can be configured by the user. In TDesk, new signals are blocked if this function is enabled and unusual spreads are detected. This state is then signaled to Desky via the TDeskSpreads[] array. The values are of TDESKSPREADS enum type: NORMAL, ABNORMAL, STOPHUNT. If the state for a symbol is other than NORMAL, Desky's stop orders are at risk. The two other states have informational character and don't need to be evaluated.

TDeskNews[]
TDesk also has an algorithm for detecting news events, which can be configured by the user. It is based on René's library. In TDesk, new signals are blocked for a certain time before and (optional) after news events if this function is enabled. This state is then signaled to Desky via the TDeskNews[] array. The values are of TDESKNEWS enum type: NONEWS, LOWNEWS, MEDIUMNEWS, HIGHNEWS. If the state for a symbol is other than NONEWS, Desky's stop orders are at risk. The three other states have informational character and don't need to be evaluated.

Cheers
Great Thomas. Thanks. :clap: :clap: :clap: :clap: :clap:

This makes hiding the sl/tp and reacting to news events/wide spreads easy to code into Desky.

: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 3y is in post 1. From the updated trade exit strategies section of the user guide:
  • HideStopLossAndTakeProfit: I added this feature after this discussion at SHF. It will prevent stops being taken out unprofitably when the spread has widened to an unacceptable level. Enabling this feature tells Desky not to send 'hard' stop loss and take profit prices with a trade. Instead he monitors the market, calculate notional SLTP's and closes the trade if either of these are breeched i.e.
    • Buys close when the Bid price rises to the notional take profit or falls to the notional stop loss.
    • Sells close when the Ask price falls to the notional take profit or rises to the notional stop loss.
At the mo, this only prevents closure during rollover. Abnormal spread and news events are coming tomorrow.

: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 3z is in post 1.

I was in the mood for a little gentle coding tonight - especially as Thomas and Rene have already done the hard work for me. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

I have added functionality to deal with unacceptable spreads and impending news events. There is a new inputs section, "Spread, news and rollover inputs" just above, "Counter trend scalping" that holds the relevant inputs. I think their meaning is obvious, but read the user guide if you are unsure.

I moved the rollover code to this section - makes sense to me.

Coders wanting to check what I have done, find the enum newsEvents section currently at line 90, the inputs section at line 411, then do a search for doNewsAndSpreadThgingies to find the function and where it is called in OnTimer().

: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
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Desky. TDesk's trading drone.

Post by tomele »

Perfect collaboration between TDesk and Desky on this subject!

:yahoo: :yahoo: :yahoo: :yahoo: :yahoo:

One little amendment, though.

The level you set for news impact in TDesk will be the minimum level Desky can respond to. For example, if you set TDesk to react only to HIGH impact news, only those will be signaled to Desky. Then Desky can not react to LOW or MEDIUM impact news, no matter what you configure. Just so you know, guys.

Cheers
Thomas
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
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 »

tomele » Tue Nov 19, 2019 8:56 pm wrote:Perfect collaboration between TDesk and Desky on this subject!

:yahoo: :yahoo: :yahoo: :yahoo: :yahoo:

One little amendment, though.

The level you set for news impact in TDesk will be the minimum level Desky can respond to. For example, if you set TDesk to react only to HIGH impact news, only those will be signaled to Desky. Then Desky can not react to LOW or MEDIUM impact news, no matter what you configure. Just so you know, guys.

Cheers
Thomas
I have added a teensy bit to the UG along these lines.

Mind, anyone unable to work this out for itself cannot use either TDesk or Desky and is doomed to Forex failure anyhow, so it doesn't really matter.

: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 4 is in post 1.

I realised that hiding the take profit and stop loss prices stops the scaling out feature from working, so V4 fixes this.

The DIY is simple. Navigate to: bool scaleOutStopLoss(int ticket)

Scroll down to this comment: //Cannot work this function if there is no stop loss. Turn the two lines of code that follow into comments by inserting // in front of the code. The code will turn gray.

The function needs to calculate a notional stop loss, so scroll down a couple more lines to this comment:
//Save stuff for easier typing

The order of the snippet that follows needs a slight rearrangement and then the code to calculate the notional stop loss needs adding. The easiest way is to copy this over the top of the existing block:

Code: Select all

   //Save stuff for easier typing
   int type = OrderType();
   string symbol = OrderSymbol();
   double price = OrderOpenPrice();
   double stop = OrderStopLoss();
   if (HideStopLossAndTakeProfit)
      stop = calculateStopLoss(symbol, type, price);
: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.”