Average Position Up

Posted By: leohermoso

Average Position Up - 01/25/20 00:23

Hi, I am trying to achieve the following result: Everything I trail my stop loss I want to increase the size of my positions

I know the following TMF code is wrong, but how is the correct way to achieve this?

Code
int TrailingAndAdding(var lookback)
{

	if (TradeIsOpen && TradeProfit > 0 )
	{
		
		if (TradeIsLong)
		{
			TradeStopLimit = max(TradeStopLimit, LL(lookback, 0));
			//Increase my Position by one unit
			TradeLots++;
		}
		else if (TradeIsShort)
		{
			TradeStopLimit = min(TradeStopLimit, HH(lookback, 0));
			//Increase my Position by one unit
			TradeLots++;
		}

	}

	return 0;
}



Best Regards

Leo Hermoso
Posted By: AndrewAMD

Re: Average Position Up - 01/25/20 17:44

You cannot increase the position of a trade. You can either partially close it or close it entirely.

Suppose your position is 10 lots long, and you want to increase it to 12, you enterLong for 2 lots. Yes, now you have to manage 2 trades.

Alternatively, if you are using the Virtual Hedging feature (Hedge = 5, Zorro S only), you can close the original 10 long trade and place another 12 long. At the end of your run() call, Zorro will place a single +2 lot trade to split the difference. This is a very nice feature.
Posted By: leohermoso

Re: Average Position Up - 01/28/20 22:07

That's an interesting approach Andrew. Tks for your reply.
© 2024 lite-C Forums