NexusFi: Find Your Edge


Home Menu

 





Thinkscripts


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one RedK with 20 posts (15 thanks)
    2. looks_two pbenson68 with 15 posts (1 thanks)
    3. looks_3 RemoWilliams with 5 posts (1 thanks)
    4. looks_4 courier12 with 5 posts (0 thanks)
      Best Posters
    1. looks_one optntdr13 with 8.3 thanks per post
    2. looks_two Silvester17 with 8 thanks per post
    3. looks_3 Massive l with 3 thanks per post
    4. looks_4 RedK with 0.8 thanks per post
    1. trending_up 80,253 views
    2. thumb_up 73 thanks given
    3. group 52 followers
    1. forum 111 posts
    2. attach_file 32 attachments




 
Search this Thread
  #31 (permalink)
Vince
Chicago, IL USA
 
Posts: 4 since Sep 2012
Thanks Given: 1
Thanks Received: 0

RedK - thanks again for your direction. Yesterday was my first time on futures.io (formerly BMT) and am not familiar yet with the Elite portion of the site. Seems I'll need to intitiate a subscription before accessing - correct?

Regards,

Vince

Reply With Quote
  #32 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

Hi Vince, that's correct.. i hope you'll find it valuable, as i did
cheers,
RedK

Visit my NexusFi Trade Journal Reply With Quote
  #33 (permalink)
 pbenson68 
San Diego CA
 
Experience: Beginner
Platform: TOS
Trading: StocKs
Posts: 26 since May 2012
Thanks Given: 14
Thanks Received: 5


RedK View Post
i'll try to help, it looks interesting and fairly easy in ToS script. but i got lost in the thread.. if you can explain in a simple way how the counting works? i see --11235 and some dots .. so not sure what's the logic behind it and what's the signal we need to capture..

Cheers,
RedK

Here is a quote from the author of the thread to clear up the count back.

When there is a higher value bar of the CCI after a lower (be it – or +), do not count the lower value bar as one of the 5 count back bars. EX: Say the following were the value of the CCI bars: 205, 188, 161, 144, 175, 140, 160, 186, 154, 141, 101.

Counting back 1st lower bar-188, because 175 is higher than the 2 previous, ignore them; 160, ignoring 140; then we have 186 causing us to ignore 161 thru 160; 154, 141, 101. The price reversal most often takes place at the close of the 5th bar, where I would short the market, be it daily, 15 min, 5 min, or , in the TF case-377 tick. The same is the case with negative numbers, where the trade is long."

So it's a basic count back from the current CCI bar to the last high CCI bar, start counting when the CCI breaks +- 45


.

Reply With Quote
  #34 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

Hi pbenson68,
got it.. we need "5 consecutive descending values" for the count to work .. otherwise we reset the count.. thought I saw the idea somewhere before..

give me some time.. in interesting scripting exercise.. will give it a shot and get back to you,
Cheers,
Red

Visit my NexusFi Trade Journal Reply With Quote
  #35 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

pbenson68,
i gave this a shot as promised.. in ToS i couldn't show the count on the CCI histogram .. the 1,2,3 counters can only be shown on the price (top) chart as far as i could twist the script (maybe someone else can) .. so we can have this as a top study and counts above or below the price bars/candles..

on a lower study, i could do a square like in the attached, then additionally can show an arrow up or down when the count reaches 5 ..
i'll leave the jdugement up to you if this method works .. i saw no reversals at the count but i may be looking at the wrong timeframe or instrument .. jus ttrying to help if this is useful to you..



let me know if that comes close to what you're looking for or i can pass you the script and you continue to play with it until you get your results.. screenshot shows how the test i did compares to the standard CCI study
cheers,
RedK

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #36 (permalink)
 pbenson68 
San Diego CA
 
Experience: Beginner
Platform: TOS
Trading: StocKs
Posts: 26 since May 2012
Thanks Given: 14
Thanks Received: 5


RedK View Post
pbenson68,
i gave this a shot as promised.. in ToS i couldn't show the count on the CCI histogram .. the 1,2,3 counters can only be shown on the price (top) chart as far as i could twist the script (maybe someone else can) .. so we can have this as a top study and counts above or below the price bars/candles..

on a lower study, i could do a square like in the attached, then additionally can show an arrow up or down when the count reaches 5 ..
i'll leave the judgment up to you if this method works .. i saw no reversals at the count but i may be looking at the wrong time frame or instrument .. just trying to help if this is useful to you..



let me know if that comes close to what you're looking for or i can pass you the script and you continue to play with it until you get your results.. screen shot shows how the test i did compares to the standard CCI study
cheers,
RedK

Dude that's awesome!! Very nice work.
The blocks are just as good or better. It looks like it works. I have an attempt also that actually puts numbers up but it was not working properly ( was force to rig the look for highest CCI with a fold constant, could not use a variable). I use the vertical line function to add numbers:



Example:
AddVerticalLine(visible = CCI < 0, text = Concat(CCInum2, ""));


Think or swim won't let me use a variable as the constant in the fold function to look for the highest bar so it would not work 100%. I can send it to you or try to work it into your working code.

This code counts bars to the positive crossover
def bar_to_neg = fold j = 1 to 15 with bar_to_neg_ID = 0 while ( CCI > 0) do if CCI[j] > 0 then bar_to_neg_ID + 1 else bar_to_neg_ID;
def k = getvalue(bar_to_neg,0);

When I use k in the fold it does not work always. It works when I to post the numbers but not when I use it to look for the Highest bar in the CCI.

example this won't work in TOS
# find High CCI
def High_CCI = fold m = 1 to k with High_CCI_temp = 0 while (CCI > 0) do if getvalue(CCI,m,0) > getvalue(CCI,m-1,0) then getvalue(CCI,m,0) else High_CCI_temp;

Reply With Quote
Thanked by:
  #37 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

Hi,
i thought fold won't be an easy route .. so i didn't go that way..
i just used a simple square signal (above or below) that counts once the bar starts decreasing..
the issue here you won't get only 5 counts, but more if the CCI value continue to decrease with no reversal .. can live with that..

it's a lot easier to build this as a "top study" that plots on the price chart, and you can then have the number counted above or below the bar, and in the color you want .. but can't do that as a lower study

then thought to also add an arrow up/down when the count reaches 5 .. that's a bit tricky
but if the square signals work for you.. i don't need to do it (at least now )

feel free to play with the code .. i attached as txt for you / code is commented. reach out if i can help further
cheers,
RedK

CCI_counter_test.txt

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #38 (permalink)
 pbenson68 
San Diego CA
 
Experience: Beginner
Platform: TOS
Trading: StocKs
Posts: 26 since May 2012
Thanks Given: 14
Thanks Received: 5


RedK View Post
Hi,
i thought fold won't be an easy route .. so i didn't go that way..
i just used a simple square signal (above or below) that counts once the bar starts decreasing..
the issue here you won't get only 5 counts, but more if the CCI value continue to decrease with no reversal .. can live with that..

it's a lot easier to build this as a "top study" that plots on the price chart, and you can then have the number counted above or below the bar, and in the color you want .. but can't do that as a lower study

then thought to also add an arrow up/down when the count reaches 5 .. that's a bit tricky
but if the square signals work for you.. i don't need to do it (at least now )

feel free to play with the code .. i attached as txt for you / code is commented. reach out if i can help further
cheers,
RedK

Attachment 89515

ok thanks, I was looking to use it as a profit taking signal so yes it will work. Did you want my ugly uncommented code?

Reply With Quote
  #39 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

no code is ugly .. pls share .. we all learning

cheers, RedK

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #40 (permalink)
 pbenson68 
San Diego CA
 
Experience: Beginner
Platform: TOS
Trading: StocKs
Posts: 26 since May 2012
Thanks Given: 14
Thanks Received: 5


RedK View Post
Hi,
i thought fold won't be an easy route .. so i didn't go that way..
i just used a simple square signal (above or below) that counts once the bar starts decreasing..
the issue here you won't get only 5 counts, but more if the CCI value continue to decrease with no reversal .. can live with that..

it's a lot easier to build this as a "top study" that plots on the price chart, and you can then have the number counted above or below the bar, and in the color you want .. but can't do that as a lower study

then thought to also add an arrow up/down when the count reaches 5 .. that's a bit tricky
but if the square signals work for you.. i don't need to do it (at least now )

feel free to play with the code .. i attached as txt for you / code is commented. reach out if i can help further
cheers,
RedK

Attachment 89515

I was playing with this tonight. I noticed 2 issues. The first was a counter issue. Let's say you have CCI values of 54 45 35 37 the counter would from 54 would go like this 45:1 35:2 then 37 is above 35 it becomes the new 2. 35 is now not included in the count.


Second when the CCI breaks the +- 45 the counter should still count. I modified the counter section to read.
# Pb68 modified countup and countdown condition to zero instead, it can go below 45 line
def Count_up = CCIv > 0 and CCIv < CCIv[1];
def Count_Dn = CCIv < 0 and CCIv > CCIv[1];
#original
#def Count_up = CCIv > over_bought and CCIv < CCIv[1] ;
#def Count_Dn = CCIv < over_sold and CCIv > CCIv[1];
#original end

Here is the latest rev
CCI_counter_test_rev 09-19-2012.txt

The delimma still exists on the counter. I can't see how it can be done in the code without a fold. It's looking for a true false condition and then ploting the signalflag.

Reply With Quote




Last Updated on March 25, 2019


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts