If I may, can I progress this thread as I am having difficulty in learning how to use this programming language too.

a good exercise would be to develop a script that emulates the Triangle indicator in the book by Jaeckle and Tomasini. They developed a profitable system from this method which another advantage that it was the market 1-2% of the time.

In this book they break down the setup to a volatility indicator and a moving average. Essentially the conditions are that the volatility indicator of the last 300 bars has dropped to its lowest point and the moving average of the last 200 bars is nearly horizontal.

This is all I have so far. It is terrible and doesn't do anything but generate a price chart of the asset.


//I will try to code a similar indicator to the traditional TA version of the triangle/flag/consolidation pattern


//A volatility indicator is required of the last 300 days


////////////Try the MACD with fixed period components?

function run()
{

BarPeriod = 60;
LookBack = 300;

vars Price = series(price());
BBands(series(price()),30,1,1,MAType_SMA);
var BollingerBandsOscillator = BBOsc(Price,100,1,300);



// plot signals and thresholds
plot("BBands",1,NEW,BLUE);
// plot("Signal",Signal[0],NEW,RED);
// plot("Threshold1",Threshold,0,BLACK);
// plot("Threshold2",-Threshold,0,BLACK);
PlotWidth = 600;
PlotHeight1 = 300;




}