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

HGB FIFO and Error Traps Thread
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4169
Page 3 of 6
Author:  MurphyMan [ Tue May 05, 2015 5:45 pm ]
Post subject:  HGB FIFO and Error Traps Thread

Spandau, thanks for the PM. Yes, I know what you mean when FXCM lumps the TPs together. Maybe they do the same with SLs. I imagine what they are trying to do is to maintain FIFO.

This has really screwed up discretionary scalping trading. Say, you place a buy order at 1.000 and the order is filed. Naturally, the price drops. :cry: Say, you are fairly certain it's a just pullback during an overall uptrend, so you place another buy order at 0.800 and it gets filled. So, the price rises a bit, heading up to 0.900 and you decide to take some money off the table and you want to close the 0.800 trade. Wrong-O buster. If you want to close that trade you must also close the 1.000 trade at a loss.

I may be looking at Bold Trader's suggestion for ATCBrokers. I know that Citi FX also doesn't have to follow the FIFO rules.

As far as buys go this keeps you from adding Rad trades for, say 30 pips. Say you open a Trend trade at 1.000 and a Rad trade at 1.150 with a 30 pip TP. You can't just close the Rad trade and take the 30 without closing the Trend too.

Sucks.
Author:  spgandau [ Tue May 26, 2015 8:23 pm ]
Post subject:  HGB FIFO and Error Traps Thread

MurphyMan » Tue May 05, 2015 12:45 pm wrote:Spandau, thanks for the PM. Yes, I know what you mean when FXCM lumps the TPs together. Maybe they do the same with SLs. I imagine what they are trying to do is to maintain FIFO.

This has really screwed up discretionary scalping trading. Say, you place a buy order at 1.000 and the order is filed. Naturally, the price drops. :cry: Say, you are fairly certain it's a just pullback during an overall uptrend, so you place another buy order at 0.800 and it gets filled. So, the price rises a bit, heading up to 0.900 and you decide to take some money off the table and you want to close the 0.800 trade. Wrong-O buster. If you want to close that trade you must also close the 1.000 trade at a loss.

I may be looking at Bold Trader's suggestion for ATCBrokers. I know that Citi FX also doesn't have to follow the FIFO rules.

As far as buys go this keeps you from adding Rad trades for, say 30 pips. Say you open a Trend trade at 1.000 and a Rad trade at 1.150 with a 30 pip TP. You can't just close the Rad trade and take the 30 without closing the Trend too.

Sucks.
Hello,
I have been working on an idea. I have set no TP and no SL values at all. I have been using the EA feature to close the trade on an opposite signal. This is highly unusual, but it might begin to address the FXCM issue of 'lumped' TP and SL values. I am using it on a small live acct. After a few weeks, I will let you know if it is practical.
I have also been thinking through a solution that would work inside the existing EA and would allow the user to set TP / SL prices...as it currently works. HOWEVER, using hidden pips (already part of the EA), when the order is created, there will be no TP or SL prices entered on the actual order itself. This is an ambitious undertaking, and I know it will require me to focus on the older versions of the HGB EA from Steve Hopwood (ver1e_strict_spgandau).

Cheers!
Author:  spgandau [ Wed May 27, 2015 9:27 pm ]
Post subject:  HGB FIFO trade route adjustments

Hello,
I have been reviewing my work on HGB_v1e and BoHGB2x3, related to FIFO errors.
Here is a small, but important change, in the coding that should be applied to your current operations. I will refer to HGB_ver01e_strict_spgandau for this....however, it is easily applied to any version you use with FIFO mods.

1. bool CloseOrder(....). around line 2420. after the while(..) loop, and before the 'return(false)' command: insert the line: TradeIsNotBusy(); //if pgm reaches here, trade has failed because the counter = 0.
explanation: this needs to exist to "unlock / close" the trade route, if the counter reaches zero (due to a persistent repeating server error ). There have been cases where the trade route is left "locked / open", and other EA's are prevented from trading.

2. line 2411 -- is a comment. It should be changed to correctly read:
//if pgm reaches here, trade has failed, BUT the err is NOT from the list above...it is something else

3. void OnInit(). around line 969. remove line TradeIsNotBusy();
explanation: this has caused existing EAs that are trying to hold the trade route to be unexpectedly released...causing a legitimate trade order to fail.

I hope all your trades are working well.

Cheers!
Author:  spgandau [ Thu May 28, 2015 9:14 pm ]
Post subject:  HGB FIFO and Error Traps Thread

spgandau » Sat Apr 04, 2015 1:48 pm wrote:
MurphyMan » Fri Apr 03, 2015 1:00 pm wrote:What Forex giveth, Forex taketh away. At one point I was up almost $300 on a $10,000 demo. Now, I've lost all that but $27.
..............................
..............................

2015.04.03 12:58:33.020 10.7 HGB_v01e_strict_spgandau EURUSD,H4: Inside TradeContext.mqh, TradeIsBusy(), 2nd while..loop, the waiting time in TradeIsBusy() (30 sec) was exceeded!

...........................
.........................
I have been surprised by this 2nd error enough times that I began hunting. I originally was hit by it when I modified HGBB for closealltrades, and one of the trades would not close (for other reasons) and HGBB threw this "2nd while..loop, the waiting time in TradeIsBusy() (30 sec) was exceeded!" at me.

Originally, I explained it as: (which is correct, and functions properly)
The 2nd line does throw a "fault' which seems to have been that TradeContext.mqh never received a clear signal that the trade context was free. It waited 30 seconds for the Empty4 server (broker), but the server context was never made free to make a trade. After 30 secs, TradeContext.mqh quit trying, and the trade never took place. That appears to be a server (broker) issue. It correctly showed you that an error had been thrown, and why.

HOWEVER, it still bothered me, and I just discovered the logic flaw in CloseOrder. I have modified my code as follows:
existing code:
} //---end while(counter > 0) loop
//
return(false);
MODIFY IT TO READ:
} //---end while(counter > 0) loop
//
//if pgm reaches here, trade has failed, and the counter = 0.
TradeIsNotBusy();
//--
return(false);

What happened was that the counter went to zero and the logic skipped the prior line which would have released the trade route, so it remained closed.

Also, refer to my May 27 post.

I hope this helps.

Cheer and good trading.
Author:  pt2004 [ Thu Jun 18, 2015 9:42 pm ]
Post subject:  HGB FIFO and Error Traps Thread

Hello spgandau,

Nice work on this ea´s :good: :good:

Is is possible to have a 2x3 version working with the indicator version of our choice instead of the library??
Tried to do some copy pasting :oops: :oops: :oops: :oops: , but it didn't work :oops: :oops:

Thank you

Best regards

PT
Author:  spgandau [ Fri Jun 19, 2015 2:01 am ]
Post subject:  HGB FIFO and Error Traps Thread

pt2004 » Thu Jun 18, 2015 4:42 pm wrote:Hello spgandau,

Nice work on this ea´s :good: :good:

Is is possible to have a 2x3 version working with the indicator version of our choice instead of the library??
Tried to do some copy pasting :oops: :oops: :oops: :oops: , but it didn't work :oops: :oops:

Thank you

Best regards

PT
That request needs to be handled by BoHGB. He opted to make BoHGB and use the library route.
It is possible to change the 2x3 version back to using a library, but it would require quite a bit of time to do, and I am not sure that, at this point, I can do this. I have left that option to BoHGB.

Cheers!
Author:  remix919 [ Tue Jun 30, 2015 7:05 pm ]
Post subject:  HGB FIFO and Error Traps Thread

Hi there spgandau,

Is the 10.7 HGB_v01k_strict_spgandau.mq4 version correct? I just downloaded it and tried to load it onto an Empty4 chart, but it wouldn't load, so I loaded it up in the editor and when I tried to compile, I got 25 errors =\ MetaEditor 5
Author:  spgandau [ Wed Jul 01, 2015 5:40 pm ]
Post subject:  HGB FIFO and Error Traps Thread

remix919 » Tue Jun 30, 2015 2:05 pm wrote:Hi there spgandau,

Is the 10.7 HGB_v01k_strict_spgandau.mq4 version correct? I just downloaded it and tried to load it onto an Empty4 chart, but it wouldn't load, so I loaded it up in the editor and when I tried to compile, I got 25 errors =\ MetaEditor 5
Hi there,
this was not compiled for MT5. My guess is that there are enough differences between Empty4 and MT5 that it will cause some failures. I don't have MT5 loaded, so am unable to help you there.
I will re-try to load this on my machine (and Empty4) to verify it compiles cleanly, and let you know what I find.

Cheers,

Scott
Author:  remix919 [ Wed Jul 01, 2015 5:42 pm ]
Post subject:  HGB FIFO and Error Traps Thread

spgandau » Wed Jul 01, 2015 12:40 pm wrote:
remix919 » Tue Jun 30, 2015 2:05 pm wrote:Hi there spgandau,

Is the 10.7 HGB_v01k_strict_spgandau.mq4 version correct? I just downloaded it and tried to load it onto an Empty4 chart, but it wouldn't load, so I loaded it up in the editor and when I tried to compile, I got 25 errors =\ MetaEditor 5
Hi there,
this was not compiled for MT5. My guess is that there are enough differences between Empty4 and MT5 that it will cause some failures. I don't have MT5 loaded, so am unable to help you there.
I will re-try to load this on my machine (and Empty4) to verify it compiles cleanly, and let you know what I find.

Cheers,

Scott
I'm using Empty4 as the terminal running the EA still, MetaEDITOR 5 is just the newest editor I believe? Or is there something wrong with my installation?
Author:  spgandau [ Wed Jul 01, 2015 6:31 pm ]
Post subject:  HGB FIFO and Error Traps Thread

remix919 » Wed Jul 01, 2015 12:42 pm wrote:
spgandau » Wed Jul 01, 2015 12:40 pm wrote:
remix919 » Tue Jun 30, 2015 2:05 pm wrote:Hi there spgandau,

Is the 10.7 HGB_v01k_strict_spgandau.mq4 version correct? I just downloaded it and tried to load it onto an Empty4 chart, but it wouldn't load, so I loaded it up in the editor and when I tried to compile, I got 25 errors =\ MetaEditor 5
Hi there,
this was not compiled for MT5. My guess is that there are enough differences between Empty4 and MT5 that it will cause some failures. I don't have MT5 loaded, so am unable to help you there.
I will re-try to load this on my machine (and Empty4) to verify it compiles cleanly, and let you know what I find.

Cheers,

Scott
I'm using Empty4 as the terminal running the EA still, MetaEDITOR 5 is just the newest editor I believe? Or is there something wrong with my installation?
Just to confirm, before I try recompiling....have you installed TradeContext.mqh? do you have the #include <WinUser32.mqh> and #include <stdlib.mqh> installed?

Cheers.
All times are UTC Page 3 of 6