Hi guys,

I'm new in this forum while I used Zorro already for a while for backtesting.

I faced an issue that I really don't understand why this happen and I could not find any solution in that forum.
My goal is to include in my strategy partial exits of my positions.
When I enter the trade, I cannot say how many lots (in this case stocks) I need to sell - this depends on some factors like volatility.

I find in the manual the function exitTrade. The function has as input a pointer to a trade and optional the price and the amount of lots I like to exit.
Tha manuel tells me the following: "Exits a particular trade completely or partially at market or at a given price limit. Returns 0 when the order failed, otherwise nonzero."

To make a more simple example, I coded a strategy which enteres the first two Wednesdays of my trading period the market, and shall start to exit them in quarters afterwards.
Unfortunately it exits my complete trades ones.

Here is the code:

Code
int counter = 0;

void run()
{	
	set(PLOTNOW|LOGFILE);
	
	LookBack = 0;
	Fill = 3;
	Verbose = 2;
	StartDate = 20200101;
	EndDate = 20200228;
	Slippage = 0;
	asset("AAPL_EOD");
	
	//Entering position
	if(dow()==3 && counter<2){
		enterLong(100*(counter+1));
	}
	
	//Counter
	if(dow()==3)
		counter ++;
	
	//Closing position
	if(dow()==3 && counter>2){
		for(open_trades){
			exitTrade(ThisTrade, 0, TradeLots/4);
		}
	}

}


And here is the part of the log file that shows the problem:

[4: Wed 20-01-08 16:00] 73.54/75.35\73.54/75.04
[AAPL_EOD::L00501] Long 100@76.04 at 15:00:00
...
Wednesday 20-01-15 Loss -33.30 ----
Current DD: 106$ (44.2%) (new depth)
[AAPL_EOD::L01001] Long 200@77.61 at 15:00:00
...
Wednesday 20-01-22 Profit +83.70 ----
Current DD: 161$ (30.0%) (new depth)
[AAPL_EOD::L00501] Sell 100@78.68: +263 Bid 78.67
[AAPL_EOD::L01001] Sell 200@78.68: +212 Bid 78.67

I would expect to sell only a quarter of the position, meaning 25 for the first trade and 50 for the second. But as you can see it sells the whole position.

Any hints or alternative implementation are welcome.
Thank you!