Signal's function appeared on specific datetime

Hello Dears, how can I set short, and cover signal's function appeared on specific datetime?

thanks, in advanced

@ahm.montaser, for example in this way:
(apply to the current symbol - in a range that includeds both referenced dates and set the analisys to trade Short):

dn = DateNum();

toShortDate = 1250707; //  7th July 2025 as per DatenNum format
toCoverDate = 1250729; // 29th July 2025 as per DatenNum format

Short = dn == toShortDate; // and Name() == "XYZ"; if you want to short a specific ticker when using a watchlist
Cover = dn == toCoverDate;

You can also use the DateTime() array and set the comparison variables to dates, but I prefer to use DateNum() because it is not ambiguous.

@amh.montaser, please, be aware that in the above simple example, the trades are executed using my “Analisys settings” tabs (no delays and close price - clearly not what you would like to use in your code).

Use SetTradeDelays() and set the ShortPrice and CoverPrice as needed.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.