Simple Coding Help - No Promise.

I got it done in R. AB should really give out different period returns of the strategy rather than just a trade list.
There is a site called datacamp that teaches beginner level R.
 
Hi Dearies
im like trying to create a custom function like this
Code:
function LkBk( array,n )
{
  // initialize 
  result[ 0 ] = array1[ 0 ];
  result[ 1 ] = array1[ 1 ] ;
  LB =Ref(array,(n-n))>Ref(array,(n-(n-1)) && Ref(array,(n-(n-1)))>Ref(array,(n-(n-2)) && Ref(array,(n-(n-2)))>Ref(array,(n-(n-3)) [B][COLOR="Red"]&& So On............ [/COLOR][/B]&& Ref(array,(n-(n-(n-1))))>Ref(array,(n-(n-n));
  // To Get Ref(array,0)>Ref(array,-1) && Ref(array,-1)>Ref(array,-2) && Ref(array,-2)>Ref(array,-3) [B][COLOR="red"]&& So On........... [/COLOR][/B]&& Ref(array,(n-1))>Ref(array,n);
  for( i = 0; i < BarCount; i++ )
  {
   result[ i ] = LB[ i ];
             
  }
  return result;
}
And im like stuck wit && So On............. part
any direction wd b grtly aprctd
tnx guys cheers
lovvy
You need to express your requirement in plain language.

Q1) You want every array element to have AND'D comparison of all of its prior pairs?

Q2) You want every array element to have OR'D comparison of all of its prior pairs?
 
I need simple programm help.. this is small programm..

Hi .. plz any one convert this amibroker logic to MT4. Thanks in advance...

PHP:
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
n= Param("No. of Bars",3,2,8,1);
TrendUp = H > Ref(HHV(H,n),-3);
TrendDn = L < Ref(LLV(L,n),-3);
TrendUp = ExRem(TrendUp,TrendDn);
TrendDn = ExRem(TrendDn,TrendUp);
PlotShapes(TrendUp*shapeUpArrow,colorGreen);
PlotShapes(TrendDn*shapeDownArrow,colorBlue);

Conversion cannot be termed as Simple help. Anyways read this very first post of this thread.
 

NJ23

Well-Known Member
Yes, I've heard R can handle cube type arrays but my encounter with R is limited to downloading EOD data from NSE servers and little rectification of that data which is needed to be able to upload into my database.

Whether AB should or should not is not a question that can debated on this thread.

Assuming you have a licensed copy of AB, raise this issue in its own forum. They may either agree to include it or perhaps guide you on how it can be done.
That's right. That can be done.
 
I need simple programm help.. this is small programm..

Hi .. plz any one convert this amibroker logic to MT4. Thanks in advance...

PHP:
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
n= Param("No. of Bars",3,2,8,1);
TrendUp = H > Ref(HHV(H,n),-3);
TrendDn = L < Ref(LLV(L,n),-3);
TrendUp = ExRem(TrendUp,TrendDn);
TrendDn = ExRem(TrendDn,TrendUp);
PlotShapes(TrendUp*shapeUpArrow,colorGreen);
PlotShapes(TrendDn*shapeDownArrow,colorBlue);



If any ready to convert this 2 afl to mt4 .. plz send quote madhavareddy1203 at gmail

im ready to pay.

plz send amount: required days.
 
Sorryyyyy

You need to express your requirement in plain language.

Q1) You want every array element to have AND'D comparison of all of its prior pairs?
Yes comparison to it's immiedt prev element upto Ref(array,-n) like this
Ref(array,0)>Ref(array,-1) AND
Ref(array,-1)>Ref(array,-2) AND
Ref(array,-2)>Ref(array,-3) AND
continue so on..... upto
AND Ref(array,-(n-1))>Ref(array,-n);

(where n>0 (positive integer) and n<may be 20 or 30)


Q2) You want every array element to have OR'D comparison of all of its prior pairs?
No, not 4 now
tnx
lovvy
 
Last edited:
HTML:
ND = Day() != Ref(Day(), -1);

///// VWAP and SDs /////

P = (H + L) / 2;
VWP = P * V;
BI = BarIndex();
BeginBI = ValueWhen(ND, BI);
BeginBI = BeginBI[BarCount -1];
if(BeginBI < BarCount - 1)
	{
	InRange = BI >= BeginBI;
	CumV = Cum(V * InRange);
	CumVWP = Cum(VWP * InRange);
	VWAP = CumVWP / CumV;
	S = Cum(Ref(CumV, -1) * V * (P - Ref(VWAP, -1))^2 / CumV);
	Variance = S / CumV;
	SD = sqrt(Variance);
	VWAP = IIf(InRange, VWAP, Null);
	Plot(VWAP, "VWAP", colorYellow, styleNoTitle + styleNoRescale);
	Plot(VWAP + SD, "+1SD", colorGreen, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP - SD, "-1SD", colorRed, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP + 2*SD, "+2SD", colorSeaGreen, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP - 2*SD, "-2SD", colorOrange, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP + 3*SD, "+3SD", colorPaleGreen, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP - 3*SD, "-3SD", colorLightOrange, styleDashed + styleNoTitle + styleNoRescale);
	}

///// PVP /////

BarSinceND = BarsSince(ND);
iStart = Max(BarCount - 1 - BarSinceND[BarCount - 1], 0);
Top = HighestSince(ND, High);
Bot = LowestSince(ND, Low);
Range = Top - Bot;
BoxesInRange = Range / TickSize + 1;
VolUnit = Volume / ((High - Low) / TickSize + 1);
VUcount = 0;
MaxVUcount = 0;
PVP = Null;

if(iStart > 0)
{
for(i = iStart; i < BarCount; i++)
	{
	jShift = round((Bot[i - 1] - Low[i]) / TickSize);
	if((BoxesInRange[i] < BarCount))
		{
		if(jShift > 0)
			{
			LastVUcount = VUcount;
			VUcount = 0;
			for(j = jShift; j < BoxesInRange[i]; j++)
				{
				VUCount[j] = LastVUCount[j - jShift];
				}
			}
		jStart = round((Low[i] - Bot[i]) / TickSize);
		jEnd = round((High[i] - Bot[i]) / TickSize);
		for(j = jStart; j <= jEnd; j++)
			{
			VUcount[j] = VUcount[j] + VolUnit[i];
			MaxVUcount = Max(MaxVUcount, VUcount[j]);
			}
		}
	}
for(j = 0; j < BoxesInRange[BarCount - 1]; j++)
	{
	if(MaxVUcount == VUcount[j])
		PVP = Bot[BarCount - 1] + j * TickSize;
	}
Plot(PVP, "PVP", colorTurquoise, styleDots + styleNoTitle + styleNoRescale);
}
can someone please see this code. found in traderslaboratory. not plotting anything.
 

Similar threads