swingONE

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

Re: swingONE

Post by SteveHopwood »

Khalaad wrote:
SteveHopwood wrote:
Khalaad wrote:Any idea, why why the EA executes two trades simultaneously, rather than one :?:

Khalid
Does this happen every time, or just occasionally?

:D
Every time.

Khalid
Things do not always compile just as we intend them to. I remember an occasion where the only way I could use Ask in one particular circumstance was to create a string with the DoubleToStr function, then extract the value of the string into a separate double.

In bool bool SendSingleTrade, try removing the 'else' from this block, and testing the crim thingy explicitly:

Code: Select all

else
      {
         ticket = OrderSend(symbol, type, lotsize, price, slippage, stop, take, comment, MagicNumber, expiry, col);
      }
Try changing the block to

Code: Select all

if (!CriminalIsECN) ticket = OrderSend(symbol, type, lotsize, price, slippage, stop, take, comment, MagicNumber, expiry, col);
      
Sing out if that makes no difference.

:D
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.
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: swingONE

Post by markft »

Khalaad wrote:
SteveHopwood wrote:
Sing out if that makes no difference.

:D
Thank you, Steve. :)

Khalid

Hi Khalid,

Can you also please post the log file if the issue does not go away after this? I could not reproduce an issue with regular or intermittent double trades.

Thanks mate,
Mahmut
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: swingONE

Post by markft »

SteveHopwood wrote:
markft wrote:Thanks Peter for clarifying. I wanted to see if the immediate close was due to a bug with this EA.

I am guessing MPTM closed it as the SL will always set to 0 for this symbol. You should be able to fix it - just initialise "multiplier" to 1 in the EA init function as in my earlier post.
Only browsing here with no real idea what is going on, but you guys should be aware that a fault has emerged in the tp/sl calculations function of my shell code. Khalid used the shell to create the first version of this EA, so the fault could be causing some problems.

double CalculateStopLoss(int type) contains this line of code:

Code: Select all

if (HiddenPips > 0) stop = NormalizeDouble(stop + (HiddenPips * Point), Digits);
If StopLoss = 0 and there is no other sl used (Atr etc) and HiddenPips > 0, this code will result in a stop that is 0 plus the value of HiddenPips, which will probably close out as soon as the trade is sent,

Correct it with

Code: Select all

if (HiddenPips > 0 && stop > 0) stop = NormalizeDouble(stop + (HiddenPips * Point), Digits);
There is a similar correction needed in double CalculateTakeProfit(int type)

Code: Select all

if (HiddenPips > 0 && take > 0) take = NormalizeDouble(take - (HiddenPips * Point), Digits);
:D
Thanks for the heads up Steve. OOTB HiddenPips is set to 0 so I am guessing this is why this hasn't been reported yet.

Fixed this now in the 1.9.9 version (not yet posted; will do some more testing first).
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: swingONE

Post by markft »

Khalaad wrote:
markft wrote:
Khalaad wrote:
Thank you, Steve. :)

Khalid

Hi Khalid,

Can you also please post the log file if the issue does not go away after this? I could not reproduce an issue with regular or intermittent double trades.

Thanks mate,
Mahmut
Mahmut,

You should know by now I am a Empty4/MQL nincompoop. :oops:

I request you incorporate the suggestions in a new version, and I shall be happy to take it from there. :)

Khalid
As requested, please see attached.

Primarily coming from a C++ background, I would be quite surprised if Empty4 interpreter did not process the else correctly; but hey with Empty4 you should perhaps never get surprised. :)

Khalid please let me know if this fixes the double trade issue.
You do not have the required permissions to view the files attached to this post.
Last edited by markft on Sat Jan 21, 2012 1:23 pm, edited 1 time in total.
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: swingONE

Post by markft »

Khalaad wrote:
markft wrote: As requested, please see attached.

Primarily coming from a C++ background, I would be quite surprised if Empty4 interpreter did not process the else correctly; but hey with Empty4 you should perhaps never get surprised. :)

Khalid please let me know if this fixes the double trade issue.
Certainly, Mahmut.

Thank you. :)

Khalid
Hi Khalid,

Please download 1.9.9 again if you got it before. I put some additional logging and there was a typo in it...
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.

Re: swingONE

Post by SteveHopwood »

Another thought guys, inspired by the info that not everyone has been getting the double trade thingy, and which I have been contemplating for a while..

If you are using the Stealth pending trade technology, then my code sends a trade if the ea detects a pending trade line and spots that the market is on the trading side of the line.

As soon as the trade send is successfully verified, the code deletes the pending trade line, but the verification process might take time. Is it possible that the line deletion from the chart can be delayed by some Empty4 thingy for just long enough for the ea to receive another tick and go through the trade-trigger process again, before the line has actually disappeared?

If all else fails, try inserting a 2 second sleep after the trade send is verified li this into both the HasxxxFilled() functions:

Code: Select all

bool result = SendSingleTrade(Symbol(), type, TradeComment, SendLot, price, stop, take);
         if (result)
         {
           Sleep(2000); 
ObjectDelete(pendingbuypriceline);
            PendingBuy = false;      
         }//if (result)      
         else
         {
            OldBars = 0;   // Retry next tick
         }
Just a thought.

:D
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.
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: swingONE

Post by markft »

Khalaad wrote:No double trades so far. :)

The only trade Monday morning is a single trade. The GBPUSD (Stop and) Reverse to Short was not per the allocated lot size, but the same size as the previous two Lond trades combined. :(

Khalid
Hi Khalid,

The EA uses the lot argument and does not have any code to double it. I haven't seen either the double trade or the lotsize doubling issues in my testing. I will download a demo of your broker Divisa to see if this is due to brokers.

Would you mind sending me the setfile and expert logs so I can try to identify the cause?

Kind Regards
To
fx800
Trader
Posts: 1334
Joined: Sun Dec 04, 2011 4:11 am

Re: swingONE

Post by fx800 »

Hi Mahmut,

I have changed the multiplier code = 1 for the MPTM EA as you suggested but the same problem happened again this a.m. Shortly after 6 am gmt, two shorts were sent and both closed almost immediately beccause stop loss hit.

I have since removed the MPTM EA again.

Attached below is the experts log.

Many thanks.

Cheers,
Peter
You do not have the required permissions to view the files attached to this post.
AltosT
Trader
Posts: 85
Joined: Mon Nov 21, 2011 8:44 am
Location: Australia

Re: swingONE

Post by AltosT »

Hi Khalid,
Seems strange that Oanda did not gap down as did the others. I am presently running FXPro only (who gapped down also) but I have noticed that some brokers open an hour later, which more often than not would cause a gap. So question is, did the criminals open with the market or later. Won't show on one hour chart either as they fill in the missing bar. You have to actually see when and where the first tick comes.
markft
Trader
Posts: 82
Joined: Thu Dec 08, 2011 12:06 pm
Location: Sydney, Australia

Re: swingONE

Post by markft »

fx8000 wrote:Hi Mahmut,

I have changed the multiplier code = 1 for the MPTM EA as you suggested but the same problem happened again this a.m. Shortly after 6 am gmt, two shorts were sent and both closed almost immediately beccause stop loss hit.

I have since removed the MPTM EA again.

Attached below is the experts log.

Many thanks.

Cheers,
Peter
Hi Peter,

Hmm, I am not familiar with the MPTM and there are a few versions around. There must be another similar condition that calculates stop loss to 0 when the crim reports Digits = 0 for the MPTM.

I can see log lines such as
06:08:32 MPTM 30+0 PC1 JS30.mq4 mod GBPJPY,Weekly: Alert: Stop loss hit. Close of US30 ticket no 107792
which confirm it is the MPTM.

Perhaps you can contact Steve to resolve it. If he is busy I can give it a shot if you can post the version you are using.

I would suggest remove MPTM as you have already done for the time being. The swingOne EA sets the stoploss as well so there is no reason to run MPTM for stop loss alone.

Cheers mate,
Mahmut
Post Reply

Return to “Automated trading systems”