// Trend Trading ///////////////////
#include <profile.c>
function run()
{
Verbose = 3;
set(LOGFILE); // log all trades
StartDate = 2013;
EndDate = 2023; // fixed simulation period
BarPeriod = 15;
// Debug: Print original rollover values
printf("\nOriginal RollShort: %f, RollLong: %f", RollShort, RollLong);
// Adjusting rollover values
RollShort = RollShort / 365.;
RollLong = RollLong / 365.;
// Debug: Print adjusted rollover values
printf("\nAdjusted RollShort: %f, RollLong: %f", RollShort, RollLong);
vars Prices = series(price());
vars Trends = series(Laguerre(Prices,0.05));
Stop = 10*ATR(100);
MaxLong = MaxShort = -1;
if(valley(Trends))
enterLong();
else if(peak(Trends))
enterShort();
}