You can't explain this to my wife, can you?SteveHopwood » 19 Nov 2019, 01:14 wrote:What Thomas wants is what he gets.
Jokes aside, we should work on something similar when it comes to news events.
Cheers
You can't explain this to my wife, can you?SteveHopwood » 19 Nov 2019, 01:14 wrote:What Thomas wants is what he gets.
Don't expect any greater success on my behalf than you have already enjoyed. I will try my best mind.
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.Jokes aside, we should work on something similar when it comes to news events.
Cheers
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.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)
Great Thomas. Thanks.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
At the mo, this only prevents closure during rollover. Abnormal spread and news events are coming tomorrow.
- 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.
I have added a teensy bit to the UG along these lines.tomele » Tue Nov 19, 2019 8:56 pm wrote:Perfect collaboration between TDesk and Desky on this subject!
![]()
![]()
![]()
![]()
![]()
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
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);