Simple Coding Help - No Promise.

manishchan

Well-Known Member
Thanks Amit but it didn't help. :(

This is what I'm looking for. See the pic below. 1st High Low should be drawn on 15 min. After that on each Hourly High Low. I have drawn only 1st Hourly high low (9:30-10:30) but the code should draw other hourly after that .. like 10:30-11:30, 11:30-12:30... till 2:20-3:30.

Let me know if possible. Thanks :)

 

rmike

Well-Known Member
Following code gives me two horizontal lines for H L of previous candle in any time frame.
Code:
PH = LastValue(Ref(H, -1));
  Plot(PH, "PH",colorGreen,styleLine|styleNoRescale|styleNoTitle);

PL = LastValue(Ref(L, -1));
  Plot(PL, "PL",colorPink,styleLine|styleNoRescale|styleNoTitle);
How can I extend it by say 5 bars in the blank bar area?
Hi Josh,

The desired extension is inbuilt in the "Plot" function itself. (Happy's post referenced by amitrandive in post #1972)

However, a possibly niftier way of achieving the same is enumerated below, with an adjustable extension parameter (defaulted to 5).

Code:
/***********************************************************************************
Coder - rmike
Code For - Traderji Members
Permissions - This is permitted to be distibuted freely in its entirety with no
modifications and acknowledgement to original coder
Disclaimer - The provision of the code does not constitute trading/ investment advice.
The code is meant for educational purposes only
************************************************************************************/ 
_SECTION_BEGIN("Last HL");
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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

ext = Param("Extend", 5, 1, 15, 1);

PH = LastValue(Ref(H, -1));
PL = LastValue(Ref(L, -1));

hx0 = LastValue(BarCount -(ext + 2)); 
hx1 = BarCount - 1; 
Line1 = LineArray( hx0, PH, hx1, PH, 1); 
lx0 = LastValue(BarCount - (ext + 2)); 
lx1 = BarCount - 1; 
Line2 = LineArray( lx0, PL, lx1, PL, 1);
Plot( Line1, "H", ParamColor("LB1 High Color", colorGreen), styleLine, Null, Null, ext); 
Plot( Line2, "L", ParamColor("LB2 High Color", colorPink), styleLine, Null, Null, ext);
_SECTION_END();
Regards,

PS - One good turn deserves another :)

PPS - This forum needs to revisit its policies regarding upload of attachments
 

amitrandive

Well-Known Member
Thanks Amit but it didn't help. :(

This is what I'm looking for. See the pic below. 1st High Low should be drawn on 15 min. After that on each Hourly High Low. I have drawn only 1st Hourly high low (9:30-10:30) but the code should draw other hourly after that .. like 10:30-11:30, 11:30-12:30... till 2:20-3:30.

Let me know if possible. Thanks :)

Manish

The code I have posted , gives an output like the image below.

 

josh1

Well-Known Member
Manish

The code I have posted , gives an output like the image below.

Amit,

In my case, Amibroker creates candles frm 9:15-10:15-11:15-12:15-13:15-14:15-15:15. So the last one is 15 minutes. How do you get it like 9:15 to 9:30 and then hourly?
Is it there in settings?
 
Dear Friends,

I seek a small suggestion/guidance from you, about Trading on NSE.

Do you know/think any way for some sort of priced based trading (you might call it automated trading too)? Let me make my query more clear,

Suppose if nifty is trading it 7550 level

Can I set a command through any software (supported by NSE) if Nifty reaches a certain level, say 7650, then SBI or RIL or any other scrip which I set, could be bought or sold at CMP (or any price set by me, I understand in case of pre-determined price by me, my trade could remain un-execueted too).

If you know, please reply and guide me.

If such software is available on subscription basis (if affordable), I can pay the price for same too!



Thanks in advance (i had posted in the derivative section, but nobody replied there)
 

josh1

Well-Known Member
Hi Josh,

The desired extension is inbuilt in the "Plot" function itself. (Happy's post referenced by amitrandive in post #1972)

However, a possibly niftier way of achieving the same is enumerated below, with an adjustable extension parameter (defaulted to 5).

Code:
/***********************************************************************************
Coder - rmike
Code For - Traderji Members
Permissions - This is permitted to be distibuted freely in its entirety with no
modifications and acknowledgement to original coder
Disclaimer - The provision of the code does not constitute trading/ investment advice.
The code is meant for educational purposes only
************************************************************************************/ 
_SECTION_BEGIN("Last HL");
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", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

ext = Param("Extend", 5, 1, 15, 1);

PH = LastValue(Ref(H, -1));
PL = LastValue(Ref(L, -1));

hx0 = LastValue(BarCount -(ext + 2)); 
hx1 = BarCount - 1; 
Line1 = LineArray( hx0, PH, hx1, PH, 1); 
lx0 = LastValue(BarCount - (ext + 2)); 
lx1 = BarCount - 1; 
Line2 = LineArray( lx0, PL, lx1, PL, 1);
Plot( Line1, "H", ParamColor("LB1 High Color", colorGreen), styleLine, Null, Null, ext); 
Plot( Line2, "L", ParamColor("LB2 High Color", colorPink), styleLine, Null, Null, ext);
_SECTION_END();
Regards,

PS - One good turn deserves another :)

PPS - This forum needs to revisit its policies regarding upload of attachments
Thanks to both of you.
 
Amit,

In my case, Amibroker creates candles frm 9:15-10:15-11:15-12:15-13:15-14:15-15:15. So the last one is 15 minutes. How do you get it like 9:15 to 9:30 and then hourly?
Is it there in settings?
yes,

mine is configured to give hourly on the hour i.e. 9:15 to 10:00, then 11,12,...and 3-3:30

How to

Go to File >> Database Settings >> Intraday Settings >> Set Start Time and End Time

Your current setting would be 9:15 to 3:30

change it to 8:30 to 3:30 for first bar from 9:15 to 9:30 and then hourly

or 9:00 to 3:30 etc.

Happy :)
 

amitrandive

Well-Known Member
Dear Friends,

I seek a small suggestion/guidance from you, about Trading on NSE.

Do you know/think any way for some sort of priced based trading (you might call it automated trading too)? Let me make my query more clear,

Suppose if nifty is trading it 7550 level

Can I set a command through any software (supported by NSE) if Nifty reaches a certain level, say 7650, then SBI or RIL or any other scrip which I set, could be bought or sold at CMP (or any price set by me, I understand in case of pre-determined price by me, my trade could remain un-execueted too).

If you know, please reply and guide me.

If such software is available on subscription basis (if affordable), I can pay the price for same too!
Thanks in advance (i had posted in the derivative section, but nobody replied there)
References available in the Algo and Automatic trading section

http://www.traderji.com/algo-automa...ng-nest-plus-auto-trading-api.html#post810272

http://www.traderji.com/algo-automa...ing-daily-paper-trade-updates.html#post968472

http://www.traderji.com/algo-automa...-individual-traders-reposting.html#post904345
 

Similar threads