Hi
I import COT data but in a different way to you but this how I plot the
COT data
Assuming the chart that you are looking at is GBPUSD and the COT OI
ticker is called OI_GBP and you want to plot the OI separately
then create function file called \# include COT Symbol.afl as below
which when ticker == "GBPUSD" stores `GBP' in the global
variable includeCotTicker
function includeCOTsymbol(ticker)
{
global includeCotTicker;
includeCotTicker = WriteIf(ticker == "GBPUSD" ,"GBP");
}
To plot the OI use the code below. You need to change the folder address
to where you store the function file
// Plot Foreign Ticker
#include "C:\Program Files\AmiBroker\Formulas\# include\# include COT
Symbol.afl";
includeCOTsymbol(Name());
// This calls function "includeCOTsymbol()" in file "# include COT
Symbol.afl" and sends the ticker "name()",then sets the ticker to the
global variable "includeCotTicker "
// This uses the Global Variable 'includeCotTicker' which is set in #
include.afl
Ticker = "OI_ " + includeCotTicker ";
SetForeign(ticker);
TickerName = FullName();
ForeignOpen = O;
ForeignHigh = H;
ForeignLow = L;
ForeignClose = C;
ForeignInterval = Interval(2);
ForeignDate = Date();
RestorePriceArrays();
Color = ParamColor("Color", colorDarkBlue);
PlotForeign( Ticker, "", ParamColor("Color", colorDarkBlue),
ParamStyle("Style", styleLine, maskAll) );
GraphXSpace=10;
_N( Title = EncodeColor(colorRed) + tickername + " " + ticker +
EncodeColor(colorDarkBlue) + " " + ForeignInterval + " " +
ForeignDate + " " + StrFormat(" Close %g", ForeignClose ));
The end result would be a window with a chart for GBPUSD and separate
chart for OI_GBP.
You will have to add extra includeCotTicker = WriteIf(ticker == "GBPUSD"
,"GBP"); lines for different tickers and have a different plot file
for each COT indicator i.e. Commercial Net.
As you change the main ticker i.e. say to USDYEN then the appropriate
COT chart will also change.
Hope this helps
Peter
--- In [email protected], "goedings" <[EMAIL PROTECTED]> wrote:
>
> Hi, I have read Larry Williams book on COT and its application to
> trading. I have downloaded the historical data and have it all in one
> MS Access db. Now I want the data in AB and construct the indicators.
>
> I have been able to get the data in AB: I have exported key fields per
> ticker to ASCI and imported them in AB as a new symbol basically
> mapping those fields to standard o/h/l/c fields. In the ASCI wizard I
> have ticked the non-quotes, allow for neg pricing etc.
>
> The mapping is:
> High -> Open interest
> Open -> Nett Commercials
> Low -> Nett Traders
> Close -> Nett Public
>
> From the dataview for the new created ticker I see the data there. So
> I have e.g. a ticker called "OI_GBP" which contains the key
> OpenInterest data fields for British Pound.
>
> Now come the difficulties. If I have GBPUSD as active symbol and
> create a new indcator that acesses via Foreign() the ticker with COT
> data ("OI_GBP") it won't plot the required fields. It seems that it
> will only plot the values in the "close" field of ("OI_GBP").
>
> Probably this is caused by the foreign() function:
> wOI=TimeFrameCompress(Foreign("OI_GBP","open",1),inWeekly);
>
> It should plot nett commercials but it plots the nett public....
>
> Anyone?
>