import aux1 data

trash

Well-Known Member
#2
You wanna import to existing data, right? For that you have to use $Hybrid command being set tot true. Also since no OHLC data is available in your import file you have to check allow negative prices.

And last but not least it makes no sense to import date data a second time. Also it is not possible to import date to Aux1. Instead use flag 1. It will have same effect since all other dates will have Aux1 to zero. So you just have to check for Aux1 == 1 in your AFL or i.e.
dn = IIf( Aux1 == 1, DateNum(), 0 );



Anyway here is picture
 
Last edited:
#3
You wanna import to existing data, right? For that you have to use $Hybrid command being set tot true. Also since no OHLC data is available in your import file you have to check allow negative prices.

And last but not least it makes no sense to import date data a second time. Also it is not possible to import date to Aux1. Instead use flag 1. It will have same effect since all other dates will have Aux1 to zero. So you just have to check for Aux1 == 1 in your AFL or i.e.
dn = IIf( Aux1 == 1, DateNum(), 0 );



Anyway here is picture
I have done as you said but SYMBOL>Quote editor ....is not showing any data means data is not imported .
I just want to import dates in Aux1 and plot vertical lines on those dates
or
check my post 3149 http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-315.html
Originally Posted by SIGNAL View Post
Hello I want an AFL for following conditions

I have some support resistance day dates imported in Aux1 field.
Say the stock INFY has following dates
30.05.2014 ,10.10.2014, 30.10.2014,01.12.2014 , 13.01.2015

check chart http://imgur.com/ao4UR8n

I want to plot a horizontal lines from the high and low of these dates ,if the price touches high or low of this date the line should cease there other wise continue .

30.05.2014 : high low not touched
10.10.2014 : high touched so no line,but low not touched so line continue
30.10.2014 : high touched on 08.12.2014 and low touched on 11.12.2014
01.12.2014 : high line up to 22.01.2015,low touched next day so no line
13.01.2015 : high touched so no line,low not touched so line till 24.04.2015
 

KelvinHand

Well-Known Member
#4
I have done as you said but SYMBOL>Quote editor ....is not showing any data means data is not imported .
I just want to import dates in Aux1 and plot vertical lines on those dates
or
check my post 3149 http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-315.html
Originally Posted by SIGNAL View Post
Hello I want an AFL for following conditions

I have some support resistance day dates imported in Aux1 field.
Say the stock INFY has following dates
30.05.2014 ,10.10.2014, 30.10.2014,01.12.2014 , 13.01.2015

check chart http://imgur.com/ao4UR8n

I want to plot a horizontal lines from the high and low of these dates ,if the price touches high or low of this date the line should cease there other wise continue .

30.05.2014 : high low not touched
10.10.2014 : high touched so no line,but low not touched so line continue
30.10.2014 : high touched on 08.12.2014 and low touched on 11.12.2014
01.12.2014 : high line up to 22.01.2015,low touched next day so no line
13.01.2015 : high touched so no line,low not touched so line till 24.04.2015
Hello,

Mr Trash already give you his valuable advice
- Aux1, Aux2 values cannot be date format, it can only be in floating point format.
- No need to duplicate the Date Format
- Aux can be used as status flags, if aux1 is 1, then draw the down S&R based on the date given.

that simple.

I had tested Mr Trash method, and the editor show the value as per his post #2. I even set the aux1 from 1 to 5, and the quote editor shown that.
 
Last edited:

trash

Well-Known Member
#5
I have done as you said but SYMBOL>Quote editor ....is not showing any data means data is not imported .
I just want to import dates in Aux1 and plot vertical lines on those dates
or
check my post 3149 http://www.traderji.com/amibroker/90119-simple-coding-help-no-promise-315.html
Originally Posted by SIGNAL View Post
Hello I want an AFL for following conditions

I have some support resistance day dates imported in Aux1 field.
Say the stock INFY has following dates
30.05.2014 ,10.10.2014, 30.10.2014,01.12.2014 , 13.01.2015

check chart http://imgur.com/ao4UR8n

I want to plot a horizontal lines from the high and low of these dates ,if the price touches high or low of this date the line should cease there other wise continue .

30.05.2014 : high low not touched
10.10.2014 : high touched so no line,but low not touched so line continue
30.10.2014 : high touched on 08.12.2014 and low touched on 11.12.2014
01.12.2014 : high line up to 22.01.2015,low touched next day so no line
13.01.2015 : high touched so no line,low not touched so line till 24.04.2015

Listen, if I tell something then I'm not doing it to waste my time but tell about something that holds the water, makes sense and actually works.
If it does not work for you then you did something wrong on the road to success.

If INFY price data exists before like this
Then you will see that Aux1 field are all zero.



After described import method in post #2 the quote editor will look like the following...


Then after writing some line array code the H-L lines where Aux1 == 1 will show up on chart.
 

KelvinHand

Well-Known Member
#6
Listen, if I tell something then I'm not doing it to waste my time but tell about something that holds the water, makes sense and actually works.
If it does not work for you then you did something wrong on the road to success.

If INFY price data exists before like this
Then you will see that Aux1 field are all zero.



After described import method in post #2 the quote editor will look like the following...


Then after writing some line array code the H-L lines where Aux1 == 1 will show up on chart.
In such a way, the aux1 & aux2 can be used to hold the price values (either high, low or 0) that the horizontal line to draw, and 0 value for no draw. then that simplify the code.
Based on your chart, you plot both high & low horizontal line, but in his requirement, can be either High or Low OR both.
 
Last edited:

trash

Well-Known Member
#7
Sure, it is up to him what to do. I don't know which lines he actually wants.
In the case he wants to plot specific ones as in his picture then CSV content would have to be
Code:
TICKER,DATE,AUX1,AUX2
INFY,2014-05-30,1,1
INFY,2014-10-10,0,1
INFY,2014-10-30,1,1
INFY,2014-12-01,1,0
INFY,2015-01-13,0,1
Import wizard


And if plotting


His INFY symbol seems to be a different one.
I was using this one from NYSE http://finance.yahoo.com/q/hp?s=INFY+Historical+Prices
 

trash

Well-Known Member
#8
The code for post #7

Code:
// Plotting set Aux flags 
// http://www.traderji.com/amibroker/98400-import-aux1-data.html#post1069659 
// example by trash

bi = Barindex();
dt = DateTime();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );

//GraphLabelDecimals = 2; // needs AB 5.90
Plot( C, "Price", colorDefault, GetPriceStyle() | styleNoTitle );

for( i = fvb; i <= lvb; i++ ) { // iterate visible chart
    if( Aux1[i] ) { // High lines
        x = LineArray( bi[i], H[i], BarCount - 1, H[i] );
        Plot( x, "\n" + DateTimeToStr( dt[i] ) + ", H", colorGreen, styleLine ); }

    if( Aux2[i] ) { // Low lines
        y = LineArray( bi[i], L[i], BarCount - 1, L[i] );
        Plot( y, "\n" + DateTimeToStr( dt[i] ) + ", L", colorRed, styleLine ); }
}

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}}  Op:%g, Hi:%g, Lo:%g, Cl:%g (%.1f%%), Vol:%g {{VALUES}}",
                       O, H, L, C, SelectedValue( ROC( C, 1 ) ), V ) );
//
 
#9
The code for post #7

Code:
// Plotting set Aux flags 
// http://www.traderji.com/amibroker/98400-import-aux1-data.html#post1069659 
// example by trash

bi = Barindex();
dt = DateTime();
fvb = FirstVisibleValue( bi );
lvb = LastVisibleValue( bi );

//GraphLabelDecimals = 2; // needs AB 5.90
Plot( C, "Price", colorDefault, GetPriceStyle() | styleNoTitle );

for( i = fvb; i <= lvb; i++ ) { // iterate visible chart
    if( Aux1[i] ) { // High lines
        x = LineArray( bi[i], H[i], BarCount - 1, H[i] );
        Plot( x, "\n" + DateTimeToStr( dt[i] ) + ", H", colorGreen, styleLine ); }

    if( Aux2[i] ) { // Low lines
        y = LineArray( bi[i], L[i], BarCount - 1, L[i] );
        Plot( y, "\n" + DateTimeToStr( dt[i] ) + ", L", colorRed, styleLine ); }
}

_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} - {{DATE}}  Op:%g, Hi:%g, Lo:%g, Cl:%g (%.1f%%), Vol:%g {{VALUES}}",
                       O, H, L, C, SelectedValue( ROC( C, 1 ) ), V ) );
//
Thanks a ton trash this is exactly what I wanted.
now I can import data

since I have imported data in Aux1 field only I can see High green lines only on the chart how can i see low of that bar too ?

The lines are continues , they should cease when a new bar touches that line,I have marked that with a white Arrow.http://imgur.com/VKXolsF

why is this showing (EMPTY) on date 5/4/2014 may be data problem I will re import and find out.

what changes should I make in the AFL to see last 3 lines or 4 lines only?

regards






chart
 

Similar threads