I attached an updated version to CointossWinLossCycle.c that will print total win/loss percentage after all accumulated cycles.

I wanted to inspect the TRADE values of a given trade but weirdly it has no correct values. Find attached StopVsProfit.c. Also I was wondering why the TRADE struct stores its values with float precision only. Wouldn't you assume that double is generally preferred? I don't know if there is a practical difference in this case, just thought it is odd because everything else is treated as double.

Code:
void run()
{
	if (Bar == StartBar)
	{
		Stop = 50*PIP;
		TakeProfit = 50*PIP;
		TRADE* pTrade = enterLong();
		
		if (pTrade)
		{			
			printf("nEntryPrice [%.7f]", pTrade->fEntryPrice); // 0.000000
			printf("nStopLimit [%.7f]", pTrade->fStopLimit); // 0.000000
			printf("nProfitLimit [%.7f]", pTrade->fProfitLimit); // 0.000000 why???
		}
	}
}




Code:
typedef struct TRADE
{
	float	fEntryPrice;	// buy price, or premium without multiplicator
	float	fExitPrice;	// sell price per unit, without spread
	float fResult;		// current profit of the trade
	float	fEntryLimit;	// buy entry limit
	float	fProfitLimit;	// profit limit price
	float fTrailLock;	// profit target distance to initial price, positive (long) or negative (short)
	float	fStopLimit;	// stop loss limit price
... Much float. Many wow.
} TRADE;


Attached Files
CointossWinLossCycle.c (8 downloads)
utils.h (5 downloads)
StopVsProfit.c (5 downloads)
Last edited by pascalx; 09/03/17 21:54.