I am writing a writeif condition (for Cond1), but BreakoutStatus is displaying blank, even when crossover has happened on the chart. Where I'm i making a mistake.
// Testing breakout condition
BreakoutLevel = Study( "BO", 1427 );
Dist = ( Close - BreakoutLevel ) / Close * 100;
//Cond1 = Close >= 0.97 * BreakoutLevel AND Close < BreakoutLevel;
Cond1 = Cross( Close, BreakoutLevel );
//Cond2 = Close >= 0.97 * BreakoutLevel;
//Cond3 = GapUp() AND (Low - Ref( High, -1 ) > 0.75 * ATR( 40 )) AND (Volume > 1.5 * MA( V, 50 )); // Buyable gap ups
//Cond3 = GapUp() ;
// Writing conditions
Breakout = IIf( Cond1, True, False );
//NearBreakout = IIf( Cond2, True, False );
//Both = IIf( Cond1 AND Cond2, True, False );
//BuyableGapUp = IIf( Cond3, True, False );
BreakoutStatus =
WriteIf( Breakout, "Breakout"," " ) ;
Filter = Cond1;
//Filter = Cond1 OR Cond2 OR Cond3;
AddColumn( Close, "Close" );
AddColumn( Study( "BO", 1427 ), "Breakout Level" );
AddTextColumn( BreakoutStatus, "Breakout Type" );
AddColumn( Dist, "Dist %" ); // Distance from breakout in % terms
Thanks i was able to use and get it working, but i have another issue now. Cond1 is showing blank when there is no study (Study( "BO", 1427 )) on the chart, if there is a study then the condition is working.
// Testing breakout condition
BreakoutLevel = Study( "BO", 1427 );
Dist = ( Close - BreakoutLevel ) / Close * 100;
Cond1 = GapUp() AND (Low - Ref( High, -1 ) > 0.75 * ATR( 40 )) AND (Volume > 1.5 * MA( V, 50 )); // Buyable gap ups
Cond2 = Cross( Close, BreakoutLevel );
Cond3 = Close >= 0.97 * BreakoutLevel AND Close < BreakoutLevel;
//Cond1 = GapUp() ;
TextList = "NoSignal\nBuyable Gapup\nBreakout\nNear Breakout";
//TextList = "Breakout";
//TextSelector = 1 * Cond2;
TextSelector = 1 * Cond1 + 2 * Cond2 + 3 * Cond3;
Filter = Cond1 OR Cond2 OR Cond3;
AddColumn( Close, "Close" );
AddColumn( Study( "BO", 1427 ), "Breakout Level" );
AddMultiTextColumn( TextSelector, TextList, "Which signal" );
AddColumn( Dist, "Dist %" ); // Distance from breakout in % terms
Cond1 has nothing to do with BreakoutLevel = Study( "BO", 1427 );
Wrap Cond2 within 'Nz()' function.
Cond2 = Nz(Cross( Close, BreakoutLevel ) );
system
Closed
January 15, 2023, 5:56am
#6
This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.