MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe) p2

cheap

Active Member
#32
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Hi Kelvin,
addrow() is still tricky to get right output.
what do i need to add extra to your code in addrow() , do i need to delete
addcolumn for it?
 
#33
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Hi boufalo,
when i do click on link, it shows "The item you are looking for is not available.".
sorry maybe you can find the correct link

the date is 17 and 18-04-15 and the subject was
[amibroker] Exploration mode issue [1 Attachment]
 

cheap

Active Member
#34
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Thank you Boufalo,

Code:
Version(6.0);
SetOption("NoDefaultColumns", True );


AddTextColumn( Name(), "Ticker",1, colorDefault,colorDefault, 80);
//AddTextColumn( FullName(), "Company",1, colorDefault,colorDefault,100);
AddColumn( DateTime() , "Date", formatDateTime, colorDefault,colorDefault, 80 );

        
AddTextColumn("#", "BullBar"); 
AddTextColumn("#", "BearBar"); 
AddTextColumn("#", "Bull Engulfing"); 
AddTextColumn("#", "Bear Engulfing"); 
AddTextColumn("$", "Shorting Star"); 
dt =Datenum();

for ( i = 1; i <=15; i++ ) 
{
    TimeFrameSet( i * in1Minute );

        O1 = Ref(O,-1); 
        C1 = Ref(C,-1);
        MP = (H+L)/2;
        R = H-L;
        

        
        //-- Condition 
        
        blBar=C>MP AND O<MP;
        brBar=C<MP AND O>MP;

        blEngulf = ((O1>C1) AND (C>O) AND (C>=O1) AND (C1>=O) AND ((C-O)>(O1-C1)));
        brEngulf = ((C1>O1) AND (O>C) AND (O>=C1) AND (O1>=C) AND ((O-C)>(C1-O1)));
        
        ss = ((R>4*(O-C)) AND ((H-C)/(.001+R)>= 0.75) AND ((H-O)/(.001+R)>= 0.75));
    
            
        Filter = blBar OR brBar OR blEngulf OR brEngulf;
        
        if ( NOT LastValue(Filter) ) break;
        
        
        x= StrFormat("%02g-min", i);
        str = "";
        str = str + WriteIf(blBar,    x, "\t");
        str = str + WriteIf(brBar,    x, "\t");
        str = str + WriteIf(blEngulf, x, "\t");
        str = str + WriteIf(brEngulf, x, "\t");
        str = str + WriteIf(ss,       x, "");
              
               
         AddRow(Name()+"\t"+DateTimeToStr( dt[i] )+"\t"+str);  /// this line has one \t less 
               
    
    
    TimeFrameRestore();

     

}  

SetSortColumns(1, -2, 3,4,5,6,7);
output:


Now i can see something, but it's showing me 00:00:00 timeframe with date. it's showing 2013(when i set 1 recent bar) ,database i do have is 2016
when i set range all quotes it' showing

and last candlestick it's showing bull engulfing it's bearish candle.
 
Last edited:
#35
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Code:
Version(6.0);
SetOption("NoDefaultColumns", True );


AddTextColumn( Name(), "Ticker",1, colorDefault,colorDefault, 80);
//AddTextColumn( FullName(), "Company",1, colorDefault,colorDefault,100);
[COLOR="Red"][B]AddColumn( DateTime() , "Date", formatDateTime, colorDefault,colorDefault, 80 );
[/B]
[/COLOR]        
AddTextColumn("#", "BullBar"); 
AddTextColumn("#", "BearBar"); 
AddTextColumn("#", "Bull Engulfing"); 
AddTextColumn("#", "Bear Engulfing"); 
AddTextColumn("$", "Shorting Star"); 


for ( i = 1; i <=15; i++ ) 
{
    TimeFrameSet( i * in1Minute );

        O1 = Ref(O,-1); 
        C1 = Ref(C,-1);
        MP = (H+L)/2;
        R = H-L;
        
        
        //-- Condition 
        
        blBar=C>MP AND O<MP;
        brBar=C<MP AND O>MP;

        blEngulf = ((O1>C1) AND (C>O) AND (C>=O1) AND (C1>=O) AND ((C-O)>(O1-C1)));
        brEngulf = ((C1>O1) AND (O>C) AND (O>=C1) AND (O1>=C) AND ((O-C)>(C1-O1)));
        
        ss = ((R>4*(O-C)) AND ((H-C)/(.001+R)>= 0.75) AND ((H-O)/(.001+R)>= 0.75));
    
            
        Filter = blBar OR brBar OR blEngulf OR brEngulf;
        
        if ( NOT LastValue(Filter) ) break;
        
        
        x= StrFormat("%02g-min", i);
        str = "";
        str = str + WriteIf(blBar,    x, "\t");
        str = str + WriteIf(brBar,    x, "\t");
        str = str + WriteIf(blEngulf, x, "\t")+
        str = str + WriteIf(brEngulf, x, "\t")+
        str = str + WriteIf(ss,       x, "");
              
               
[COLOR="red"][B]        AddRow(Name()+"\t\t\t"+str);
[/B]               
    [/COLOR]
    
    TimeFrameRestore();

     

}  

SetSortColumns(1, -2, 3,4,5,6,7);

How do you add DateTimeToStr( dt ), i ) in
AddRow(Name()+"\t\t\t"+str); ?
will it be like this below?
AddRow(Name()+DateTimeToStr( dt ), i )+"\t\t\t"+str);
i tried to add just upper one code, while dt =Datenum(); , and this
AddRow(StrFormat(Name()+DateTimeToStr( dt ), i )+"\t\t\t"+str));
it's not working

btw this AddColumn( DateTime() , "Date", formatDateTime, colorDefault,colorDefault, 80 );
is already been presented in code.
kindly use upper AddRow(Name()+"\t\t\t"+str); example.


Thank you Boufalo,

Code:
Version(6.0);
SetOption("NoDefaultColumns", True );


AddTextColumn( Name(), "Ticker",1, colorDefault,colorDefault, 80);
//AddTextColumn( FullName(), "Company",1, colorDefault,colorDefault,100);
AddColumn( DateTime() , "Date", formatDateTime, colorDefault,colorDefault, 80 );

        
AddTextColumn("#", "BullBar"); 
AddTextColumn("#", "BearBar"); 
AddTextColumn("#", "Bull Engulfing"); 
AddTextColumn("#", "Bear Engulfing"); 
AddTextColumn("$", "Shorting Star"); 
dt =Datenum();

for ( i = 1; i <=15; i++ ) 
{
    TimeFrameSet( i * in1Minute );

        O1 = Ref(O,-1); 
        C1 = Ref(C,-1);
        MP = (H+L)/2;
        R = H-L;
        

        
        //-- Condition 
        
        blBar=C>MP AND O<MP;
        brBar=C<MP AND O>MP;

        blEngulf = ((O1>C1) AND (C>O) AND (C>=O1) AND (C1>=O) AND ((C-O)>(O1-C1)));
        brEngulf = ((C1>O1) AND (O>C) AND (O>=C1) AND (O1>=C) AND ((O-C)>(C1-O1)));
        
        ss = ((R>4*(O-C)) AND ((H-C)/(.001+R)>= 0.75) AND ((H-O)/(.001+R)>= 0.75));
    
            
        Filter = blBar OR brBar OR blEngulf OR brEngulf;
        
        if ( NOT LastValue(Filter) ) break;
        
        
        x= StrFormat("%02g-min", i);
        str = "";
        str = str + WriteIf(blBar,    x, "\t");
        str = str + WriteIf(brBar,    x, "\t");
        str = str + WriteIf(blEngulf, x, "\t");
        str = str + WriteIf(brEngulf, x, "\t");
        str = str + WriteIf(ss,       x, "");
              
               
         AddRow(Name()+"\t"+DateTimeToStr( dt[i] )+"\t"+str);  /// this line has one \t less 
               
    
    
    TimeFrameRestore();

     

}  

SetSortColumns(1, -2, 3,4,5,6,7);
output:


Now i can see something, but it's showing me 00:00:00 timeframe with date. it's showing 2013(when i set 1 recent bar) ,database i do have is 2016
when i set range all quotes it' showing

and last candlestick it's showing bull engulfing it's bearish candle.
I have mentioned it multiple times above that you cant just expect to randomly modify code and get a proper output.

Put in some effort into understanding how programs work. Dont expect to just randomly copy/paste code and get something that works.

The code posted by you still has a small subtle bug which will prevent you from getting the correct output. Look at my previous messages for the hints on how to go about finding the bug.

-- no1lives4ever
 

cheap

Active Member
#36
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

just changed few lines marked in bold
Code:
Version(6.0);
SetOption("NoDefaultColumns", True );


AddTextColumn( Name(), "Ticker",1, colorDefault,colorDefault, 80);
//AddTextColumn( FullName(), "Company",1, colorDefault,colorDefault,100);
[B]AddColumn( Null , "Date", formatDateTime, colorDefault,colorDefault, 80 );
[/B]
        
AddTextColumn("#", "BullBar"); 
AddTextColumn("#", "BearBar"); 
AddTextColumn("#", "Bull Engulfing"); 
AddTextColumn("#", "Bear Engulfing"); 
AddTextColumn("$", "Shorting Star"); 
dt =Datenum();

for ( i = 1; i <=15; i++ ) 
{
    TimeFrameSet( i * in1Minute );

        O1 = Ref(O,-1); 
        C1 = Ref(C,-1);
        MP = (H+L)/2;
        R = H-L;
        

        
        //-- Condition 
        
        blBar=C>MP AND O<MP;
        brBar=C<MP AND O>MP;

        blEngulf = ((O1>C1) AND (C>O) AND (C>=O1) AND (C1>=O) AND ((C-O)>(O1-C1)));
        brEngulf = ((C1>O1) AND (O>C) AND (O>=C1) AND (O1>=C) AND ((O-C)>(C1-O1)));
        
        ss = ((R>4*(O-C)) AND ((H-C)/(.001+R)>= 0.75) AND ((H-O)/(.001+R)>= 0.75));
    
            
[B]        Filter = 1;
[/B]        
        if ( NOT LastValue(Filter) ) break;
        
        
        x= StrFormat("%02g-min", i);
        str = "";
        str = str + WriteIf(blBar,    x, "\t");
        str = str + WriteIf(brBar,    x, "\t");
        str = str + WriteIf(blEngulf, x, "\t");
        str = str + WriteIf(brEngulf, x, "\t");
        str = str + WriteIf(ss,       x, "");
              
               
         [B]AddRow(Name()+"\t"+DateTimeToStr( dt[i] )+"\t"+str);  /// this line has one \t less [/B]
               
    
    
    TimeFrameRestore();

     

}  

SetSortColumns(1, -2, 3,4,5,6,7);


I've changed filter =1;
datetime() in addcolumn, i did it to null.

1. under Datetime column it's showing 00:00:00 time, date is also wrong, it's just one month april 2016 database.

2. bull and bear candle timeframe should not be same
 
Last edited:
#37
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

just changed few lines marked in bold
I've changed filter =1;
datetime() in addcolumn, i did it to null.

1. under Datetime column it's showing 00:00:00 time, date is also wrong, it's just one month april 2016 database.

2. bull and bear candle timeframe should not be same
Here are some hints that will help you solve the problem:

  1. Both the problems you state are due to logical errors in the code.
  2. Try to see what each line of code does. You clearly have no idea of that, or else you would have solved the date problem.
  3. Try to understand the program's logic flow. Without doing this, you will never have a answer for why you are not getting proper output from the code

-- no1lives4ever
 

sr114

Well-Known Member
#38
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Here are some hints that will help you solve the problem:

  1. Both the problems you state are due to logical errors in the code.
  2. Try to see what each line of code does. You clearly have no idea of that, or else you would have solved the date problem.
  3. Try to understand the program's logic flow. Without doing this, you will never have a answer for why you are not getting proper output from the code

-- no1lives4ever
another loop is required in the 1st loop to display the date and time properly. also the 2nd loop is required to access the most recent database otherwise the exploration will start from the 1st entry in the db.

rgds
 

cheap

Active Member
#39
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Is there any bug in amibroker 6+?

this is the code i.e.
Code:
Version( 5.91 );

SetOption("NoDefaultColumns", True ); 

Filter = Status( "lastbarinrange" ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 60**); 

AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 120**); 

AddColumn( Null, "Indicator", 1, colorDefault, colorDefault, 90 ); 

AddColumn( Null, "Value", 1, colorDefault, colorDefault, 90 ); 

for( i = 10; i <= 100; i = i + 10 ) 

{ 

AddRow( StrFormat( Name() + "\t" + Date() + "\tRSI(%g)\t%1.2f", i, Nz( 

RSI( i ) ) ) ); 

}



but in ami 6+ it's showing error, no change in code.

 

sr114

Well-Known Member
#40
Re: MTF timeframe scan output (Scanning Timeframe not Pattern with single timeframe)

Is there any bug in amibroker 6+?

this is the code i.e.
Code:
Version( 5.91 );

SetOption("NoDefaultColumns", True ); 

Filter = Status( "lastbarinrange" ); 

AddColumn( Null, "Symbol", 1, colorDefault, colorDefault, 60**); 

AddColumn( Null, "DateTime", 1, colorDefault, colorDefault, 120**); 

AddColumn( Null, "Indicator", 1, colorDefault, colorDefault, 90 ); 

AddColumn( Null, "Value", 1, colorDefault, colorDefault, 90 ); 

for( i = 10; i <= 100; i = i + 10 ) 

{ 

AddRow( StrFormat( Name() + "\t" + Date() + "\tRSI(%g)\t%1.2f", i, Nz( 

RSI( i ) ) ) ); 

}



but in ami 6+ it's showing error, no change in code.

what is the bug in ami 6.0+ u think?
can u elaborate it further?
 

Similar threads