By doing so, it would allow me to maintain all chart reading variables and logic on 1 place and then use (re-use) it in all my actual strategies.
It would have to look like this (this is pseudo code, I know there are syntax errors in it)
Script 1: The chart reading logic
// define variables
public double GlobalVar1;
public double GlobalVar2;
public void ReadBars()
{
GlobalVar1 = Close[0];
GlobalVar2 = High[0];
}
Script 2 (an actual strategy holding trade logic):
OnBarUpdate()
{
ReadBars();
If (GlobalVar1 > Close[1])
{
// do something
}
}
Script 3 (another actual strategy holding trade logic):
OnBarUpdate()
{
ReadBars();
If (GlobalVar2 > Close[1])
{
// do something
}
}
Could anyone help me how to structure this and how to define the dependency between the 2 scripts (e.g. with 'use' or other techniques)
Many thanks,
Philip
Comment