It seems like I figured out a good solution to this so I'm going to put it up to see how it rolls.

I think I was on the right track with my initial code where the HighTimeFrame(HTF) calls the LowTimeFrame(LTF) function

They are essentially the same function with different TimeFrame and code to interact with run loop and each other.

// Both timeframes should be trained and have a par file written during trainmode
// They are trained in the same run loop and then in TRADEMODE
// The HTF calls the LTF trading function with the current HTF regime 1:L or -1:S
// 0 If no HTF position

Remarks:
Making the HTF trade function trade phantom is optional and can be commented out or use #ifdef or slider
I only did one test run but the total stats only showed the LTF stats just like the manual says when HTF is phantom mode
I hope this actually works and that I am not seeing things after going after it for a few days

Code

function tradeCorrelationLTF(int posvar)
{
	// posvar is position run or HTF 
	// run loop calls with 0 for TRAINMODE
	// HTF calls with 0, 1, -1 for TRADEMODE
	
	// Always trade LowerTimeFrame(LTF) so reset Phantom to off
	resf(TradeMode,TR_PHANTOM);
	
	// Algo is set/called by loop in TRAINMODE but for TRADEMODE
	// this LTF function is called by HTF so algo is not set so
	// setting it here for not TRAINMODE
	if(!(is(TRAINMODE)))
		algo("COLTF");
		
	TimeFrame = 1;
	
	// Same Trade logic as HTF
	
	// Entry Condition posvar >= 0 long or posvar <=0 for short
	if(posvar >= 0){
		if(longcondition){
				enterLong();
		}
	}
	
	if(posvar <= 0){
		if(shortcondition){
				enterShort();
		}
	}
}

function tradeCorrelationHTF()
{
	TimeFrame = frameSync(4);   // for 60 minute timeframe
	
	// Same Trade logic as LTF
	
	// Turn on Phantom for HTF TRADEMODE
	// This is optional - may help for day-trading
	// in the HTF direction -- comment out if 
	// you want to trade both HTF and LTF timeframes
	
	setf(TradeMode,TR_PHANTOM);

	// Entry Logic
	// enterLong(); 
	// or
	// enterShort();
	
	// Both timeframes should be trained and have a par file written during trainmode
	// They are trained in the same run loop but when not being trained
	// Then the HTF calls the LTF trading function with the current HTF regime 1:L or -1:S
	// 0 If no HTF position
	if(!is(TRAINMODE)){
		if(TradeIsLong)
			tradeCorrelationLTF(1);
		else if(TradeIsShort)
			tradeCorrelationLTF(-1);	
		else tradeCorrelationLTF(0);	
	}	
}

function run()
{
	set(PARAMETERS+FACTORS+LOGFILE+PLOTNOW);
	BarPeriod = 15;
	while(asset(loop("EUR/USD","USD/JPY")))
	{
		while(algo(loop("COHTF","COLTF")))
		{
			if(Algo == "COHTF"){
				tradeCorrelationHTF();
			}
			else if(Algo == "COLTF"){
				if(is(TRAINMODE))
					tradeCorrelationLTF(0);	// 0 = no trade position for TRAINMODE
			}
		}
	}
}



Last edited by bigsmack; 06/07/23 15:44.