Amibroker AFL code for Weighted Index:
Script:
//——————————————————————————
//
// Formula Name: Weighted Index
// For more scripts, visit: www.marketsecrets.in
//
//——————————————————————————
AddToComposite((Close*Volume), “~GMarketIndx”, “Avg”,atcFlagResetValues = 1);
AddToComposite(Open*((Close*Volume)/Foreign(“~GMarketIndx”, “Avg”)),”~GMarketIndx”, “O”,atcFlagResetValues = 1);
AddToComposite(High*((Close*Volume)/Foreign(“~GMarketIndx”,”Avg”)),”~GMarketIndx”, “H”,atcFlagResetValues = 1);
AddToComposite(Low*((Close*Volume)/Foreign(“~GMarketIndx”,”Avg”)),”~GMarketIndx”, “L”,atcFlagResetValues = 1);
AddToComposite(Close *((Close*Volume)/Foreign(“~GMarketIndx”,”Avg”)),”~GMarketIndx”, “C”,atcFlagResetValues = 1);
AddToComposite(Volume*((Close*Volume)/Foreign(“~GMarketIndx”,”Avg”)),”~GMarketIndx”, “V”,atcFlagResetValues = 1);
Buy = 0; // required by scan mode