TT Toolbox

Glenn

Experienced member
Messages
1,040
Likes
118
In order to keep things easy to find this thread is intended for posting any tools for use in the various strategies.
Respectfully request that the thread only contains the tools and not other comments, thanks etc. otherwise we'll end up with a ladies handbag instead of a tool box :)

Below are links to Position Size ElS and ELA code as approved by Grey1.
*** Correction - for latest version please see later post #3 **********

This code can be used for Scalping, Day-trading a few stocks at the same time, or Swing Trading a portfolio.
It is important to set the Inputs and the Data Compresssion to correct values in relation to
- what type of trade you are doing,
- how much capital you allocate to this type of trade,
- what percentage of capital you wish to risk i.e. Money Management Stop loss.
(The code uses Fixed Percentage Money Management)
- how many stocks to trade in a basket or portfolio,
- how you eliminate stocks with low ATR's which are not volatile enough to trade intraday..
Please refer to the notes in the code.

The code is not protected in case I need to make any changes, which I will post and then users can amend accordingly.
Hopefully there won't be too many queries :)
Glenn
 

Attachments

  • Position Size.ELS
    4 KB · Views: 87
  • Position Size.ELA
    4 KB · Views: 79
Last edited:
Latest version of Positions Size code

Thanks Glenn ( and Grey1 ) , it's much appreciated.

Cheers

Andy

Sorry folks I spotted an error. :whistling
Here are the revised codes
Glenn
 

Attachments

  • NEW POS SIZE.ELS
    4 KB · Views: 111
  • NEW POS SIZE.ELA
    4 KB · Views: 118
Sorry folks I spotted an error. :whistling
Here are the revised codes
Glenn

Thanks Glenn .. Awesome job and a great contribution to TT and its member

Guys,

Please use this code for day trading ,, try to basket trade as much as you can ,, this code and iraj N minute is all you need..As your capital increases the pos size increases and visa versa

Again Glen thank you sir

Iraj
 
Hi Glenn,

thanks very much for the code. I assume from the fact that you posted ELA and ELS files that this was written for TS200i. The code would not verify for TS8 as the "MaxShares" value is a reserved word and only for use in evaluating stratagies. I have therefore changed this to "MaximumShares" and also changed the background value to black as this is the default for TS8 and the white numbers were hidden by the white background. It now verifys and works ok in TS8 so I have uploaded it for anyone that needs it.
Thanks again for writing this.

Regards MarkB
 

Attachments

  • TS8_SIZE.ELD
    4.4 KB · Views: 82
Hi Glenn,

thanks very much for the code. I assume from the fact that you posted ELA and ELS files that this was written for TS200i. The code would not verify for TS8 as the "MaxShares" value is a reserved word and only for use in evaluating stratagies. I have therefore changed this to "MaximumShares" and also changed the background value to black as this is the default for TS8 and the white numbers were hidden by the white background. It now verifys and works ok in TS8 so I have uploaded it for anyone that needs it.
Thanks again for writing this.

Regards MarkB

I think it is worth adding that for anyone who had the older position size code, the inputs for this later code that give the same values are:

Capital: 25,000
Fixedpercent: 1
Basket: 1

Thus you can compare the effects of changing capital available, risk as % of account and number of equities in the basket. The ATR is hardcoded here as 14, whereas the older position size code had it as an input

Clearly this newer code is more flexible and adaptable to personal requirements, so thanks to Glenn and Mark for making it available and easy to find

Charlton
 
Compression for N-Minute + Data Feed stopped alert

Here is a small Utility indicator which does two jobs in Radar using one symbol e.g. $INDU.

1. Displays the changing Data Compression for the N-Minute Change as the day progresses
(Thanks to Evostick for this idea)
2. Sets off a sound alert if your data feed stops for more than 1 minute. (Hasn't been tested much yet)

Instructions are in comments in the code.

I haven't produced an ELA file for this yet because I need to check the commands.
If anyone wants to do the translation, feel free :)

Ultramarine, PM me if you're interested.

Glenn
 

Attachments

  • MISC.ELS
    3.8 KB · Views: 92
This code tells you the Number of times that a stock has hit LOW or High of the day

DATA compression = 1 min


iraj
 

Attachments

  • IRAJ NUMBER OF HIGH LOW.ELA
    2.9 KB · Views: 112
Stock Screener

Here is a free Stock Screener/Sorter for selecting stocks to trade based upon their technical data.

Stock Screener

Sample filters might be something along the lines of:-
Min Price = $20
Min Daily Volume = 1,500,000
Min ATR = $2 (This is Daily ATR)

Glenn
 
Thanks Glenn,

Here a stock screener for selecting stocks based on their fundamental data. It has many preset screens too.
ADVFN - ADVFN

Zak

Here is a free Stock Screener/Sorter for selecting stocks to trade based upon their technical data.

Stock Screener

Sample filters might be something along the lines of:-
Min Price = $20
Min Daily Volume = 1,500,000
Min ATR = $2 (This is Daily ATR)

Glenn
 
I'm just trying to make life a little easier, after taking some inspiration from Glenn & Evosticks idea of the indicator to show the time interval update on the N Minute Change.

I've coded up a dynamic timeframe indicator, so all you would need is a 1min timeframe in RadarScreen and it will update the implied timeframe at the correct intervals automatically.

Currently with the N Minute change, you have to change the timeframe at....

15:40 5 Min
15:54 6 Min
16:08 7 Min
16:22 8 Min and so on every 14 minutes


For example, in the pics shown I've worked on a 14 period MA ( Knowing the N Minute change is also 14 periods) , you can see that at 15:40 the implied timeframe is 5 min, then it automatically changes at 15:54 to a 6 min timeframe and again at 16:08 to a 7 min timeframe and so on.............

The code will also update as per the time interval, for example at 15:40 when your timeframe is 5 min, it will update again at 15:45 and 15:50 as you would expect.


attachment.php



attachment.php


Iraj

Would it be possible if this could be inserted into the N Minute change as it would make life easier all round. If you want any help to insert it into the code, then just give me a shout.

inputs:
Marketopen( 1430 ),
MALength( 14 );

variables:
TF1Sum( 0 ),TF1MA( 0 ), TimeFrame(0), ElapsedTime(0),Kompression(0),Bartime(0),Opentime(0),index(0);

Arrays:
TF1Closes[]( 0 );

if CurrentBar = 1 then
Array_SetMaxIndex( TF1Closes, MALength ) ;

Bartime = TimetoMinutes(time);
Opentime = TimetoMinutes(Marketopen);

Elapsedtime = Bartime - Opentime;
if Elapsedtime >= 14 then Kompression = ElapsedTime / 14;

if fracportion(Kompression) = 0 then TimeFrame = Kompression;


if fracportion(ElapsedTime/TimeFrame)=0 then begin
for index = 0 to MALength-1 begin
TF1Closes[index] = close[(TimeFrame)*index];
end;
end;

TF1Sum = Array_Sum( TF1Closes, 0, MALength-1 ) ;
TF1MA = TF1Sum / MALength ;


Cheers

Andy
 

Attachments

  • Timeframes.png
    Timeframes.png
    28.4 KB · Views: 496
  • TF_Updates.png
    TF_Updates.png
    34.8 KB · Views: 491
I'm just trying to make life a little easier, after taking some inspiration from Glenn & Evosticks idea of the indicator to show the time interval update on the N Minute Change.

I've coded up a dynamic timeframe indicator, so all you would need is a 1min timeframe in RadarScreen and it will update the implied timeframe at the correct intervals automatically.

Currently with the N Minute change, you have to change the timeframe at....

15:40 5 Min
15:54 6 Min
16:08 7 Min
16:22 8 Min and so on every 14 minutes


For example, in the pics shown I've worked on a 14 period MA ( Knowing the N Minute change is also 14 periods) , you can see that at 15:40 the implied timeframe is 5 min, then it automatically changes at 15:54 to a 6 min timeframe and again at 16:08 to a 7 min timeframe and so on.............

The code will also update as per the time interval, for example at 15:40 when your timeframe is 5 min, it will update again at 15:45 and 15:50 as you would expect.


attachment.php



attachment.php


Iraj

Would it be possible if this could be inserted into the N Minute change as it would make life easier all round. If you want any help to insert it into the code, then just give me a shout.

inputs:
Marketopen( 1430 ),
MALength( 14 );

variables:
TF1Sum( 0 ),TF1MA( 0 ), TimeFrame(0), ElapsedTime(0),Kompression(0),Bartime(0),Opentime(0),index(0);

Arrays:
TF1Closes[]( 0 );

if CurrentBar = 1 then
Array_SetMaxIndex( TF1Closes, MALength ) ;

Bartime = TimetoMinutes(time);
Opentime = TimetoMinutes(Marketopen);

Elapsedtime = Bartime - Opentime;
if Elapsedtime >= 14 then Kompression = ElapsedTime / 14;

if fracportion(Kompression) = 0 then TimeFrame = Kompression;


if fracportion(ElapsedTime/TimeFrame)=0 then begin
for index = 0 to MALength-1 begin
TF1Closes[index] = close[(TimeFrame)*index];
end;
end;

TF1Sum = Array_Sum( TF1Closes, 0, MALength-1 ) ;
TF1MA = TF1Sum / MALength ;


Cheers

Andy

Hi

I cannot insert it into the IRAJ N MINUTE as it did not verify it ,, I have to get my programmer to do that and i will do so as soon as he is back from his holidays ,

Great work

iraj
 
Hi

I cannot insert it into the IRAJ N MINUTE as it did not verify it ,, I have to get my programmer to do that and i will do so as soon as he is back from his holidays ,

Great work

iraj

Thanks Iraj for looking into it.

Cheers

Andy
 
Which are the Sheep and which are the Mules ?

In recent times with some specific market areas being the major market movers I have several times got into a trade or basket and found that a stock stood still while the market took off, along with other stocks.
This prompted me to look at Covariance i.e. what is moving with the market and what isn't ?
Below is my code for COV to compare a stock against INDU. Run this in Radar next to Iraj N-Minute change, so that as well as seeing whether a stock is Strong or Weak in relative-strength-to-market terms, you can also see the extent that it has recently been moving with the market i.e. the sheep (or if you believe that the tail is wagging the dog, the market leaders)
By trial and error using a constant I've got the Covariance value to around 1 for stocks and the code highlights in Green any stock with a Cov or 1 or more.
If you want to use COV to compare Sectors against INDU rather than stocks, then the constant (1,000,000) or the value to trigger green highlight (1) will need adjusting.

Another thing it highlights is when a Weak (N-Min) Stock starts (or is) following the markets ups and downs, which gives more choice if you are trading a small basket intraday.
The code uses the Globalvariable to Set and then Get the $INDU data, but all in the same piece of code.
The only Input is to set the number of bars to look back in whatever timeframe you put the indicator. In tests it's been set at 10 in the 1-min timeframe.
Format COV to update every tick and load some additional bars - I've got it on 100 at the moment but that may be unnecessarily large.
I've only just written the code so it hasn't been used live yet. However by comparing stock charts with INDU chart and looking at how COV works, it does add some value imo. We'll see :)
Any feedback/suggestions welcome as always.
Glenn

P.S Forgot to add - If you are using INDU instead of $INDU then you'll need to alter the code (4 lines) accordingly.
I can make it more flexible by adding an Input for this, but let's see how it goes.
 

Attachments

  • COV.ELS
    7.2 KB · Views: 66
  • COVELA.ELA
    7.2 KB · Views: 73
Last edited:
i'm sure i'm being silly here,

but if the position size indicator says 15 for the INDU how many contracts would this equate to YM, ?
 

Attachments

  • Capture.JPG
    Capture.JPG
    34.6 KB · Views: 42
Top