Simple Coding Help - No Promise.

Need your help to rectify the errors for below renko chart.
_SECTION_BEGIN("Renko");
SetBarsRequired(100000,100000);
//------------------------------------------------------------------+
// Block 1 |
//------------------------------------------------------------------+
VR=ParamToggle("View Renko","Bricks|Lines/Bars",0);
FV=Param("Initial size volatility",0.5,0.001,50,0.001);
MV=Param("Method calculation volatility",0,0,2,1);
PeriodVol=Param("Period calculation volatility",14,2,100,1);
Multiplier=Param("Multiplier volatility",1,0.1,10,0.1);
MR=ParamToggle("Method Renko","floating|fixed",1);
SG=ParamToggle("Show gap","No|Yes",1);
CG=ParamColor("Colour show gap",11);
MaxBS=Param("Maximum size brick",0,0,10,0.1);
MinBS=Param("Minimum size brick",0,0,10,0.1);
RenkoUp=ParamColor("Colour Renko upwards",colorBlack);
RenkoDown=ParamColor("Colour Renko downwards",colorBlack);
SB=ParamStyle("View bars",defaultval=styleCandle,mask=maskPrice);
color3=ParamColor("Colour bars",colorBlack);
History=Param("History size",5000,2,BarCount-1,1);
//------------------------------------------------------------------+
// Block 2 |
//------------------------------------------------------------------+
i=Max(BarCount-1-History,PeriodVol+1);
r=j=0;
direction=0;
iGapUp=iGapDown=0;
rOpen[0]=rHigh[0]=rLow[0]=rClose[0]=jUp=jDown=Open;
//-------------------------------------------------------------------
switch(MV)
{
case 0: Volatility=FV; break;
case 1: Volatility=ATR(PeriodVol)*Multiplier; break;
case 2: Volatility=StDev(Open,PeriodVol)*Multiplier; break;
}
BrickSize=Volatility[i-1];
//-------------------------------------------------------------------+
// Block 3 |
//-------------------------------------------------------------------+
while(i<=BarCount-1)
{
if(SG==1)
{
if(High[i-1]<Low)
{
iGapUp=1;
}
else
{
if(Low[i-1]>High)
{
iGapDown=1;
}
}
}
//-------------------------------------------------------------------
if(MR==0)
{
BrickSize=Volatility[i-1];
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
}
//------------------------------------------------------------------+
// Block 4 |
//------------------------------------------------------------------+
if(direction==0)
{
if(Open-rClose[r]>BrickSize)
{
rClose[r]=rOpen[r]+BrickSize;
rHigh[r]=rClose[r];
direction=1;
//-------------------------------------------------------------------
BrickSize=Volatility;
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp==1|iGapDown==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoUp;
}
continue;
}
//-------------------------------------------------------------------
else
{
if(rClose[r]-Open>BrickSize)
{
rClose[r]=rOpen[r]-BrickSize;
rLow[r]=rClose[r];
direction=2;
//-------------------------------------------------------------------
BrickSize=Volatility;
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp==1|iGapDown==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoDown;
}
continue;
}
}
}
//------------------------------------------------------------------+
// Block 5 |
//------------------------------------------------------------------+
else
{
if(direction==1)
{
if(rOpen[r]-Open>BrickSize)
{
r++;
rOpen[r]=rOpen[r-1];
rHigh[r]=rOpen[r];
rClose[r]=rOpen[r]-BrickSize;
rLow[r]=rClose[r];
direction=2;
//-------------------------------------------------------------------
BrickSize=Volatility;
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp==1|iGapDown==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoDown;
}
continue;
}
//-------------------------------------------------------------------
else
{
while(Open-rClose[r]>BrickSize)
{
r++;
rOpen[r]=rClose[r-1];
rLow[r]=rOpen[r];
rClose[r]=rOpen[r]+BrickSize;
rHigh[r]=rClose[r];
//-------------------------------------------------------------------
BrickSize=Volatility;
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp==1|iGapDown==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoUp;
}
}
}
}
//------------------------------------------------------------------+
// Block 6 |
//------------------------------------------------------------------+
else
{
if(direction==2)
{
if(Open-rOpen[r]>BrickSize)
{
r++;
rOpen[r]=rOpen[r-1];
rLow[r]=rOpen[r];
rClose[r]=rOpen[r]+BrickSize;
rHigh[r]=rClose[r];
direction=1;
//-------------------------------------------------------------------
BrickSize=Volatility;
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp==1|iGapDown==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoUp;
}
continue;
}
//-------------------------------------------------------------------
else
{
while(rClose[r]-Open>BrickSize)
{
r++;
rOpen[r]=rClose[r-1];
rHigh[r]=rOpen[r];
rClose[r]=rOpen[r]-BrickSize;
rLow[r]=rClose[r];
//-------------------------------------------------------------------
BrickSize=Volatility;
if(MaxBS>0) {BrickSize=Min(MaxBS,BrickSize);}
if(MinBS>0) {BrickSize=Max(MinBS,BrickSize);}
//-------------------------------------------------------------------
if(iGapUp==1|iGapDown==1)
{
color[r]=CG;
}
else
{
color[r]=RenkoDown;
}
}
}
}
}
}
//------------------------------------------------------------------+
// Block 7 |
//------------------------------------------------------------------+
if(VR==1)
{
jOpen[j]=Open;
jHigh[j]=High;
jLow[j]=Low;
jClose[j]=Close;
//-------------------------------------------------------------------
if(direction==1)
{
jUp[j]=rClose[r];
jDown[j]=rOpen[r];
color2[j]=color[r];
}
else
{
if(direction==2)
{
jUp[j]=rOpen[r];
jDown[j]=rClose[r];
color2[j]=color[r];
}
}
j++;
}
i++;
}
//------------------------------------------------------------------+
// Block 8 |
//------------------------------------------------------------------+
if(VR==1)
{
delta=BarCount-j;
jOpen=Ref(jOpen,-delta);
jHigh=Ref(jHigh,-delta);
jLow=Ref(jLow,-delta);
jClose=Ref(jClose,-delta);
jUp=Ref(jUp,-delta);
jDown=Ref(jDown,-delta);
color2=Ref(color2,-delta);
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 ) ) ));
PlotOHLC(jOpen,jHigh,jLow,jClose,"SRI",color3,SB);
Plot(jUp,"Up",color2,styleThick);
Plot(jDown,"Down",color2,styleThick);
}
//-------------------------------------------------------------------
else
{
delta=BarCount-1-r;
rOpen=Ref(rOpen,-delta);
rHigh=Ref(rHigh,-delta);
rLow=Ref(rLow,-delta);
rClose=Ref(rClose,-delta);
color=Ref(color,-delta);
PlotOHLC(rOpen,rHigh,rLow,rClose,"SRI",color,styleCandle);
}
_SECTION_END();
 

princy01

Well-Known Member
Re: plotting higher TF MA in lower TF

try this

can change TF...whether MA/EMA and whether on close/high/low etc

checkout various parameters

Code:
usetf = ParamToggle("Use TF", "No|Yes", 1) ;
// Author: Pratap Balakrishnan
// Copyright: All rights reserved. Not to be circulated or shared or posted on websites without the author's written permission.
// email id: [email protected]

alloff = ParamToggle("All off", "No|Yes", 0) ;

tf = Param("TF", 3, 1, 100000, 1);
Periods = Param("Periods", 13, 2, 1000, 1, 10 );
isema = ParamToggle("MA Type", "MA|EMA", 1) ;
MAstyle = ParamStyle("MA Style", styleThick) ;
Clrma = ParamColor( "Color Up", colorBlue);
isexpandLast = ParamToggle("Expand Mode", "First|Last", 1); 
expandmode = expandFirst ;
if (isexpandLast)
	expandmode = expandLast ;

if (NOT alloff)
{
	if (usetf)
	{
		tfs = tf *in1Minute ;
		TimeFrameSet(tfs) ;
	}
	else
		tfs = Interval() ;

Refp = ParamField("Price", 3);

	if (isema)
		MAhtf = EMA(Refp, Periods) ;
	else
		MAhtf = MA(Refp, Periods) ;

	if (usetf)
		MAhtfe = TimeFrameExpand(MAhtf, tfs, expandmode ) ;
	else
		MAhtfe = MAhtf ;

	str = NumToStr(tf, 1.0)+"Min"+"-P"+NumToStr(Periods, 1.0) ;
	Clr = Clrma ;
	if (usetf)
		Clre = TimeFrameExpand(Clr, tfs, expandmode ) ;
	else
		Clre = Clr ;

	if (usetf)
		TimeFrameRestore() ;

	RefMAhtfe = MAhtfe ;
	RefClre = Clre ;

	Plot( RefMAhtfe, str, RefClre, MAstyle|styleNoLabel|styleNoRescale); 
}
anybody has working solution for this , because its not working properly
 
hello senior friends...

I need help to plot exploration for below conditions..

Sell setup

1. SuperTrend 10,3 giving sell signal in 5 min chart

2. RSI (14) should be crossing or below 50 levels in 60 min chart


Buy Setup

1 Supertrend 10,3 giving buy signal in 5 min chart

2 RSI (14) should be crossing or above 50 levels in 60 min chart..


Kindly help to form a Exploration.


Thanx you in advance
 

princy01

Well-Known Member
Re: plotting higher TF MA in lower TF

anybody has working solution for this , because its not working properly
You can modify this code snippets to your requirement


Code:
TimeFrameSet(in15Minute);
e15=EMA(C,5);
e113=EMA(C,13);
e120=EMA(C,20);
TimeFrameRestore(); 
e15x5=TimeFrameExpand( e15, in15Minute,expandLast );
e15x13=TimeFrameExpand( e113, in15Minute,expandLast );
e15x20=TimeFrameExpand( e120, in15Minute,expandLast );
e15c=WriteIf(e15x5>e15x13 OR e15x5<e15x13,"One","x");
e15c2=WriteIf(e15x5>e15x13 AND e15x5>e15x20,"On","x");
e15c3=WriteIf(e15x5<e15x13 AND e15x5<e15x20,"Oe","x");
//1h
TimeFrameSet(inHourly);
e51=EMA(C,5);
e131=EMA(C,13);
e201=EMA(C,20);
TimeFrameRestore(); 
ehx5=TimeFrameExpand( e51, inHourly,expandLast );
ehx13=TimeFrameExpand( e131, inHourly,expandLast );
ehx20=TimeFrameExpand( e201, inHourly,expandLast );
ehc=WriteIf(ehx5>ehx13 OR ehx5<ehx13,"One","x");
ehc2=WriteIf(ehx5>ehx13 AND ehx5>ehx20,"On","x");
ehc3=WriteIf(ehx5<ehx13 AND ehx5<ehx20,"Oe","x");
//4h
TimeFrameSet(inHourly*4);
eh51=EMA(C,5);
eh131=EMA(C,13);
eh201=EMA(C,20);
TimeFrameRestore(); 
eh4x5=TimeFrameExpand( eh51, inHourly*4,expandLast );
eh4x13=TimeFrameExpand( eh131, inHourly*4,expandLast );
eh4x20=TimeFrameExpand( eh201, inHourly*4,expandLast );
e4hc=WriteIf(eh4x5>eh4x13 OR eh4x5<eh4x13,"One","x");
e4hc2=WriteIf(eh4x5>eh4x13 AND eh4x5>eh4x20,"On","x");
e4hc3=WriteIf(eh4x5<eh4x13 AND eh4x5<eh4x20,"Oe","x");
//d
TimeFrameSet(inDaily);
ed5=EMA(C,5);
ed13=EMA(C,13);
ed20=EMA(C,20);
TimeFrameRestore(); 
edx5=TimeFrameExpand( ed5, inDaily,expandLast );
edx13=TimeFrameExpand( ed13, inDaily,expandLast );
edx20=TimeFrameExpand( ed20, inDaily,expandLast );
edc=WriteIf(edx5>edx13 OR edx5<edx13,"One","x");
edc2=WriteIf(edx5>edx13 AND edx5>edx20,"On","x");
edc3=WriteIf(edx5<edx13 AND edx5<edx20,"Oe","x");
dont know coding , can you please be more clear on exactly what to do?:thumb:
 

Raj232

Well-Known Member
Dear Friends & coders,

Please help with code to place and order into NEST trader using Excel.
A colleague has done this in my office but will not share with anyone.
Both NEST and Excel program needs to be open, excel macros need to be enabled. Also it seems that NEST folder must be trusted in Excel macros location (trust /security).

Here there is NO need to activate NEST PLUS. it places BUY and SELL orders directly into NEST program as per macros calculating the BUY/SELL.

Thanks in advance !
 

Raj232

Well-Known Member
Dear Friends & coders,

Please help with code to place and order into NEST trader using Excel.
A colleague has done this in my office but will not share with anyone.
Both NEST and Excel program needs to be open, excel macros need to be enabled. Also it seems that NEST folder must be trusted in Excel macros location (trust /security).

Here there is NO need to activate NEST PLUS. it places BUY and SELL orders directly into NEST program as per macros calculating the BUY/SELL.

Thanks in advance !
Any luck with this guys ? Excel orders to Nest/Now? Thanks in advance.
 

cloudTrader

Well-Known Member
@ Experts ,

Is it possible to shade the space between +DI & -DI lines in the ADX indicator in Amibroker?
So if the +DI is above -DI the space between +DI & -DI gets green and vice versa.

Your help is much appreciated.

Thanks In Advance.
 

Similar threads