I revised some codes so that you can manually set prices for the top and bottom of the tree.
It makes easy to change tree height taller or shorter and place it at the corner of the chart (not to obstruct your trade) .
I also added codes to draw it automatically at the center of the chart.
Replace extern variables to the following.
PHP Code:
extern string PERIODExp = "<<< Auto Mode >>>";
extern bool AutoHeight = true;
extern int PERIOD = 100;
extern string CenterExp = "<<< Auto Draw tree at the center >>>";
extern bool DrawTreeCenter = true;
extern string ManualHeightExp = "<<< Manual Height >>>";
extern double TreeTop_Price = 1.3;
extern double TreeBottom_Price = 1.25;
extern string BarShiftExp = "<<< Manual BarShift >>>";
extern int BarShift = 100;
And replace the codes where EA defines Top and Bottom of the tree to the following.
PHP Code:
double TreeTop = TreeTop_Price;
double TreeBottom = TreeBottom_Price;
if(AutoHeight)
{
TreeTop = Low[ PERIOD ];
TreeBottom = Close[0];
if(TreeTop < TreeBottom)
{
TreeTop = Close[0];
TreeBottom = High[ PERIOD ];
}
}
int Base = BarShift;
if(DrawTreeCenter) Base = WindowBarsPerChart()/2;
How to set tree height manually:
change AutoHeight to "false" and input prices for the top and bottom of the tree.
How to set Barshift (where to draw a tree) manually:
change DrawTreeCenter to "false" and input BarShift (shift from current bar).