Entry Time based on Stock screening time

Hello seniors,

Need your suggestion on the following..

I have predefined set of rules for stocks screening.. Once screened, the stocks are shortlisted into Buy and Sell individual watchlists..

once the stocks are listed, My Trade Entry time for any stocks should be greater than the time it get listed in the watchlist.. so that I wont miss an entry..

Currently my entry time rules are as follows:

TradeStartTime = Param( "Trade Start From(HHMM)", 0915, 900, 2400, 1 );
NoEntryTime = Param( "No Entry After(HHMM)", 1440, 900, 2400, 1 );
ExitTime = Param( "Square Off Time(HHMM)", 1510, 900, 2400, 1 );

EntryTime = TimeNum()>=TradeStartTime 100 AND TimeNum()<NoEntryTime 100;
MarketClose = ExRem(TimeNum()>=ExitTime*100, LC);

How do I add time of stock getting listed in watchlist dynamically rather than havng a fixed standard start time?

I am unable to figure this out.. Kindly suggest ..

Thanks in advance :slight_smile:

All parameters are constants on run-time,
but all parameters work for specified watchlist automatically
(by AmiBroker), so, you don't need to do anything.

your code got many errors,
suggest you modify them and post it agian,
and you should block your code with code button </>
codebutton
when you are posting your article.

My Apologies...

Here is the code..

TradeStartTime = Param( "Trade Start From(HHMM)", 0915, 900, 2400, 1 );
NoEntryTime = Param( "No Entry After(HHMM)", 1440, 900, 2400, 1 );
ExitTime = Param( "Square Off Time(HHMM)", 1510, 900, 2400, 1 );

EntryTime = TimeNum() >= TradeStartTime * 100 AND TimeNum() < NoEntryTime * 100;
MarketClose = ExRem(TimeNum() >= ExitTime * 100, LC) ;

All I want is to have the "Trade STart Time " to be Greater than the watchlist entry tme of each stock.. It has to be dynamic instead of a standard time like it is now..

Looking forward to have some suggestions..

Thanks in advance

Dear Seniors,

Any help on the above?

(1) What is your "LC" on last line of your code?
(2) What is your definetion about "entry time of each stock"?

Hi Alex,

I wonder how did i missed mentioning this..m sorry again..Please look at the code below:

TradeStartTime = Param( "Trade Start From(HHMM)", 0915, 900, 2400, 1 );
NoEntryTime = Param( "No Entry After(HHMM)", 1440, 900, 2400, 1 );
ExitTime = Param( "Square Off Time(HHMM)", 1510, 900, 2400, 1 );

FC = DateNum() != Ref( DateNum(), -1 );
LC = DateNum() != Ref( DateNum(), 1 );

EntryTime = TimeNum()>=TradeStartTime*100 AND TimeNum()<NoEntryTime*100;
MarketClose = ExRem(TimeNum()>=ExitTime*100, LC);

Entry Time of each stock - I meant, the time when a stock enters into watchlist after meeting the scanning conditions..

Ex: SBIN-FUT meets my scanning condition lets say at 10 am and then the stock version of the same would be listed into watchlist 1 at 10:01 am.. If this is the case, the Trade entry time for this particular stock should be considered as after 10:05 am on 5 min candle timeframe and so should be for others dynamically based on their watchlist listed time...

Right now, I have a static time range given between 9:15am to 2:40 pm .. by doing so, stock of the above mentioned future SBIN-FUT which is SBIN is given a buy signal at 9:15 am instead it should be 10:05 am..

Note: I am creating 2 seperate watchlist for Buy side and Sell side so that Buy logic for Long entries will only applied on Buy side watchlist and viceversa for the short side entries..

Thanks for taking time and responding back.. Hope to see a solution for this..

Hello,

Any Suggestion?

I am busy for other things, so late to answer (I am not an employee of AmiBroker), just treat you as a friend.

  1. Watchlists of AB are fixed (using manual settings)
    and not a dynamicable list.

  2. AB will seperate Buy/Short side for you,
    after you setup your Buy/Short logics.

Your prerequisite are ready :sunglasses: now!
You can achieve your requirement like following code:

TradeStartTime = Param( "Trade Start From(HHMM)", 0915, 900, 2400, 1 );
NoEntryTime = Param( "No Entry After(HHMM)", 1440, 900, 2400, 1 );
ExitTime = Param( "Square Off Time(HHMM)", 1510, 900, 2400, 1 );

FC = DateNum() != Ref( DateNum(), -1 );
LC = DateNum() != Ref( DateNum(), 1 );
EntryTime = TimeNum() >= TradeStartTime * 100 
          AND TimeNum() < NoEntryTime * 100;

MarketClose = Flip( TimeNum() >= ExitTime*100, LC); // Notice this
Buy = Buy_Condition AND EntryTime AND NOT(MarketClose);
Short = Short_Condition AND EntryTime AND NOT(MarketClose);
Sell = Short;  Cover = Buy;

Use Flip() for MarketClose because it is a duration time.

Hello Alex ..

Thanks for the suggestion.. Very much appreciated :slight_smile: