https://www.multicharts.com/trading-sof ... a_function
and it looks like the signal or indicator is calling a function, is that a correct understanding?
Here is why I ask.
While I am working on signals, I have a lot of template code that gets copied into each one. One purpose for this is to evaluate different strategies for different times of the day, and things like that. For example:
Code: Select all
Inputs:
timeMorningStart( 930 ),
timeMorningStop( 1200 ),
timeAfternoonStart( 1200 ),
timeAfternoonStop( 1545 ),
dateStart ( 1200330 ),
dateStop ( 1200925 ),
minPrice ( 4 ),
maxPrice ( 12 ),
...
Variables:
longFilter1( TRUE ),
longFilter2( TRUE ),
longFilter3( TRUE ),
ShortFilter1( TRUE ),
ShortFilter2( TRUE ),
ShortFilter3( TRUE ),
timeMorning ( FALSE ),
timeAfternoon ( FALSE ),
timeAllDay ( FALSE ),
timeFilter1 ( FALSE ),
dateFilter1 ( FALSE ),
dateTimeFilter1 ( FALSE ),
priceFilter1 ( FALSE ),
...
// We need the final comparison so that the optimizer doesn't get crazy.
timeMorning = (
( time >= timeMorningStart )
and ( time <= timeMorningStop )
and ( timeMorningStart < timeMorningStop )
);
// We need the final comparison so that the optimizer doesn't get crazy.
timeAfternoon = (
( time >= timeAfternoonStart )
and ( time <= timeAfternoonStop )
and ( timeAfternoonStart < timeAfternoonStop )
);
timeAllDay = ( timeMorning or timeAfternoon );
// `timeFilter1 = ( timeAllDay );
timeFilter1 = ( timeAfternoon );
// timeFilter1 = ( TRUE );
dateFilter1 = (
( Date >= dateStart )
and ( Date <= dateStop )
);
// dateFilter1 = ( TRUE );
dateTimeFilter1 = ( timeFilter1 and dateFilter1 );
priceFilter1 = ( (Close[0] >= minPrice) and (Close[0] < maxPrice) );
Is it possible to have a signal called _filterStrategy and have that called (maybe with a "#include" ??) from the ones I am working on?
Did I just figure out why I need to use Global Variables?
Have fun,
Rob