Wrong Trade Status on HTML page for Trade profits

Posted By: Martin_HH

Wrong Trade Status on HTML page for Trade profits - 05/16/23 06:08

Probably this is a recent bug, but I just noticed it during live trading. The HTML status page and the trades.csv file are displaying incorrect profit results:
1. A short trade with a win of 387 EUR was shown as a loss of -387 EUR.
2. A long trade with a loss was displayed as a win.

I did not find any documentation of this bug. Any confirmation?

BR

Martin
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/16/23 11:13

Additional Info:

- I am using 2.53.
- I did not recognise this behaviour with my demo account (FXCM)

Could it be a difficulty with the plugin to FXCM Live account?
Posted By: jcl

Re: Wrong Trade Status on HTML page for Trade profits - 05/17/23 08:35

You mean the HTML page got a wrong sign of the profit, but the .csv file and the log got the correct sign? With all trades or only with some?
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/17/23 13:12

The trades.csv and the ...real.log were also wrong.
Example long trade: buy 1.25304 sell: 1.25288 (175.000 units)
Broker shows: -25,75 EUR Zorro: +42.66 EUR

I saw another error which I decribed above with a short trade.
It seems the error does not occur always. Today a losing Long trade was shown correctly. I will have a further look in the next days and give a statement, when I have updates:

Thanks for your response.
Posted By: jcl

Re: Wrong Trade Status on HTML page for Trade profits - 05/18/23 14:41

The profit of any trade is the difference of entry and exit price minus spread and commission. This is not different in backtest and in live trading. If something looks wrong, look up the trade in the log and check it from start to end.
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/23/23 08:02

Danke jcl
As usual the problem may be caused from another area. I just recognised that there is a link to my use of the trailing functionalities (not TMF).
I coded:
Trail = Stop = optimize(1,0.5,2.2,0.1)*ATR(100);
TrailSlope=optimize(25,100,300,25);
TrailSpeed=optimize(100,100,300,25);

It seems to work only in Long trades correctly. In the manual the trailing is described with "raising" the SL. Is this right... only in Long trades? Or do I have to use the TMF system instead ?? But I am using two loops (Markets and different strategies). Does it work?

Today, I was with a short position in profit, but I saw that the SL and Trail field, shown in the html file, are much to low. I stopped the position manually. Actually I got a win of 517 Euros. The html has shown -527 Euros. The status off Zorros shows : -527 EUR, but equity of 50519 EUR (519 EUR comes from the broker)

Sell: 1.243410 Buy: 1.241310 -527 EUR is shown in the demotrades.csv. Of course the FXCM broker shows a win as I stated.

Is there a side effect of my trailing use at short positions? Or do I have a general problem?
Additional info, I have a FXCM EU account and therefore it shoud be not a NFA flag issue, right?
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/23/23 15:19

Well, I checked the manual again and of course short positions should be possible as well, when I set Trail and Stop variable. Therefore, I still have two issues during short trades. My algorithm for entries are synchron.
1. Trailing does not work for me as it should
2. Live status does not work as it should = Backtesting seems to work correctly..... This seems not logical....

I do further tests and try to figure out why I have this behaviour. Log files. FXCM has no comission, only spread, therefore there is no rocket science behind......


Maybe the error is in front of the screen....?
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/24/23 09:08

I understood now the trailing functionality correctly with the double distance of the stop and trail value. I will further test, but it will be ok.
There is still the issue with the wrong html status. This I cannot explain, but I will continue to search:
Posted By: jcl

Re: Wrong Trade Status on HTML page for Trade profits - 05/24/23 10:36

The belief that FXCM has no commssion might be a reason of a wrong profit. Make sure to set the correct commission in the asset list.

Check a trade in the log, and determine where the printed profit deviates from the real profit. And do not confuse phantom and real trades.
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/24/23 16:26

Danke.
Yes, FXCM has spreads (they call it markups in pips) and rollover. Commission is really zero. I just downloaded via API the AssetFix.csv (asset.csv) and this was confirmed. No commission. And also in the Broker reports no commision, which is the case for many neobrokers novadays as well.
I will check the values of the trades based on this updated AssetFix file in the next days.
For me it was strange that the issue was found for short positions only. The strange thing was that the profit was almost the expected value, but only with an opposite sign.On the other hand it has shown a gain, even when I had a real loss???
I have no explanation for this so far. I will do as you have recommended. Calculate the .log of the trade data from start to the end. I let you know the result of my investigation.
Posted By: jcl

Re: Wrong Trade Status on HTML page for Trade profits - 05/26/23 10:59

You can find the commissions in the Commission field in AssetsFix.csv. They are also available on the rate card on the FXCM website.
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/30/23 08:19

Thanks for the reply. Yes, I am aware, but the comissions for my traded instruments are zero, see:

Name,Price,Spread,RollLong,RollShort,PIP,PIPCost,MarginCost,Market,Multiplier,Commission,Symbol
AUD/USD,0.653930,0.000070000,-0.3309,0.08490,0.0001000,0.092914,-6.05,0,1000,0.0,AUD/USD
EUR/USD,1.07579,0.000080000,-2.228,1.053,0.0001000,0.092914,-3.33,0,1000,0.0,EUR/USD
GBP/USD,1.23702,0.000100000,-1.254,0.5646,0.0001000,0.092914,-3.77,0,1000,0.0,GBP/USD
GER30,15840.10,1.30000,-0.2783,0.02783,1.000,0.10000,-6.48,0,1.00,0.0,GER30
NAS100,13563.78,1.00000,-0.2876,0.07421,1.000,0.092914,-5.48,0,1.00,0.0,NAS100
SPX500,4112.23,0.500000,-0.8627,0.2226,0.1000,0.092914,-5.71,0,1.00,0.0,SPX500
USD/CAD,1.35959,0.000170000,-0.7104,0.2004,0.0001000,0.068376,-3.58,0,1000,0.0,USD/CAD
USD/JPY,139.17,0.0110000,1.873,-3.916,0.01000,0.066849,-3.58,0,1000,0.0,USD/JPY
XAU/USD,1963.20,0.310000,-0.6250,0.2588,0.01000,0.0092914,-5.76,0,1.00,0.0,XAU/USD

The AssetsFix file was updated via the API of FXCM (and my Broker does not show any commissions for this trades)

I could find a possible reason for the wrong profit in the html sheet. I recognised it several times when I manually stop the position. Again, today I closed manually a Long position with a little win, Zorro shows a loss with almost the same amount.
Therefore, the issue I recognised seems to be for Long and Short positions with a manual close.

When I do not close it manually and it will be stopped out by the Zorro script, it seems to work correctly. Is there a possible issue with the plugin for FXCM?
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 05/31/23 08:07

Today, again. My Zorro script produced a nice entry for NAS100. My script had a stop and a trail. But, I wanted to secure the win and I put a trailing/ Stop order via the Broker platform.
So I was stopped out with 228 EUR win. Zorro html shows -230 EUR as a loss. Does it come with a mismatch of a Zorro "virtuell" trailing stop and the Broker one, which produces a real limit order?

Zorro works perfectly well. I used to work with Pine Script and it cost me ages to programme something which was not even similiar. This issue is a reporting issue only. I would assume that is an issue with the plugin?

For my markets the fees are included inside the spread and as I said commissions are zero.
Posted By: jcl

Re: Wrong Trade Status on HTML page for Trade profits - 06/02/23 11:39

Now I understand your problem. If you want to close a trade, close it by Zorro, not manually. NEVER set manually stops or the like. Otherwise the trade will be out of sync between Zorro and broker, and you get wrong results. I also do not really believe that your commissons are zero. Better find out the correct values, and fix your asset list. Unless FXCM likes you so much that they let you trade for free.
Posted By: Martin_HH

Re: Wrong Trade Status on HTML page for Trade profits - 06/05/23 05:48

Danke, also for the Black Book.
© 2024 lite-C Forums