Richard Dale
Norgate Data
- Joined
- 22 February 2005
- Posts
- 276
- Reactions
- 206
Trash, just a slight clarification of the above when put in the context of data sources.
"Quotation data" is always stored when you have "data source" as "(local database)". If you use a data source (such as MetaStock, eSignal etc.) then price data will be cached in this database too, upon accessing the symbol within AmiBroker if you have "Local data storage" set to Enable.
Information data (what I call "metadata" regarding a security - market/group/shares outstanding/EPS etc.) is stored in two locations - once inside broker.master and secondly within the individual symbol file within the subfolders. If you delete the broker.master file, it will regenerate it from all of the individual files upon startup/opening that database. That takes a while though if you have thousands of symbols.
SetBarsRequired( -2, -2 );
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
function tf_ma(e,d)
{
global i;
for (i=e; i<d; i++)
{
tf = i * in1Minute;
TimeframeSet(tf);
meme =MA(C, 15);
TimeframeRestore();
}
m = TimeFrameExpand(meme,tf,expandPoint);
for( b = 0; b < BarCount; b++ ) {
//PlotText(" " , b, L[ b ], colorRed, colorDefault, -12 );
if(m[b]) PlotText(" "+(i), b, L[b]-1-(i), colorCustom1);
}
return m;
}
tf_ma(1,3); // calling the function
_SECTION_BEGIN("Formula");
ddo = TimeFrameGetPrice( "O", inDaily, 0, expandPoint );
dh = TimeFrameGetPrice( "H", inDaily, 0, expandPoint );
dl = TimeFrameGetPrice( "L", inDaily, 0, expandPoint );
dc = TimeFrameGetPrice( "C", inDaily, 0, expandPoint );
PlotOHLC( ddo, dh, dl, dc, "Daily Close", colorWhite, styleCandle );
Plot( Close, "Daily Close", colorBlue );
_SECTION_END();
Hi all and a happy new year.
I am having real trouble with writing this. Can anybody help please?
I am looking to identify days where the volume is greater than any DOWN DAY's volume over the past 5 days.
The part in bold is what i can't figure out ie so that we are ignoring and previous UP day volume in the past 5 days.
This is as far as I can get but obviously it is not what I want as is taking into account all days no matter if they were up days or down days.
V>ref(HHV(V,5),-1);
Thanks for any help.
I have a feeling I answered this a while back for you....?
a = ROC(C,1)<0;
aa = ValueWhen(a,V,1);
b = HHV(aa,5);
d = V>Ref(b,-1);
Thanks again Gringotts. That's pretty darn good. Is there any way to do this without the ROC formula as that seems to filter out some days where the rise in price isn't that great?
Hoping someone can help me with multi-timeframe backtesting. I've read the AB tutorial many times and always got hung up. Time I got this sorted.
So could someone please post a code for something like the following, including what A/A time frame settings to use:
"if yesterday's daily close observed a stochastic cross, then today, buy MA cross on 5 minute time frame".
TIA
How about you starting to write a code the way you think it would work and then it gets corrected here?
Let's start with baby steps:
1. Getting yesterday's daily stoch cross through some level being viewed from intraday interval.
Hi All,
I’m starting to do some futures testing and looks for some help on position sizing. Is anyone able to point me to where I can find different position sizing methods for futures?
Specifically looking to be able to base the position size on risk parity i.e. calculate the number of contracts to buy = (0.001 x equity)/(ATR50 * PointValue).
The logic behind this is that multiplying the average true range by the point value of the specific futures contract results in how much profit/loss to expect from a normal days movements. Setting the risk factor to 0.001 meaning I’m willing to get an impact of 0.1% on my portfolio, and therefore need to multiply the risk factor with the portfolio equity to arrive at the daily impact in dollars. Then dividing this by the expected average impact of each contract fives the number of contracts to buy.
My understanding is that the calculation should look like this, however I’m having difficulty with the equity part of the equation. Does anyone know how to pull in the current equity portfolio value?
Riskfactor = Param("Risk Factor",0.01,0.005,1,0.005);
Risk = (Riskfactor*Equity())/(Ref(ATR(50),-1) * PointValue);
PositionSize = Risk * MarginDeposit;
Any help is greatly appreciated.
Thanks,
James
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?