New version 18 available now


Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Profile: sageofhalo
About
User Name: sageofhalo
Groups: Member, Platinum User, TeleChart
Rank: Registered User
Real Name:
Location
Occupation:
Interests:
Gender: Unsure
Statistics
Joined: Sunday, February 24, 2013
Last Visit: Thursday, October 04, 2018 12:42:53 PM
Number of Posts: 10
[0.00% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Storing a value in a variable for future bars to reference
Posted: Tuesday, October 02, 2018 4:13:48 PM

Hello,

I have another issue I'm trying to fix and searching hasn't turned up a solution.  I am telling a variable to be defined as price.Close(X) where X is user defined.  But really what I want is for that variable to store the value of price.Close(X) for future bars to compare against until the variable is redefined as a new value.  Is there a way to do this?

Thresh and Hold are the variables that are not sticking to the value for the bar in which they are defined.  Clearly I'm doing it wrong and need the proper coding to do what I'm after.  As an aside the code might have some redundant elements like Exit Function and Plots as I've been troubleshooting but this is where it's at right now. Also Starting Trend as "Down" is sort of a workaround at the moment.

Thank you in advance,

Connor

Here is the code:

'# Smoothing = UserInput.Integer = 5
 
Dim Ind As Single
Dim Check As Boolean = False
Dim Thresh As Single
Dim Hold As Single
Dim Trend As String = "Down"
 
 
 
Select Case Trend
Case = "Up"
Select Case price.Close
Case > price.Close(1) And Check = False
Thresh = price.Close(Smoothing)
Ind = price.Close
Plot = Ind
Exit Function
Case > price.Close(1) And Check = True And price.Close <= Hold
Ind = Hold
Plot = Ind
Exit Function
Case > price.Close(1) And Check = True And price.Close > Hold
Check = False
Thresh = price.Close(Smoothing)
Ind = price.Close
Plot = Ind
Exit Function
Case <= price.Close(1) And Check = False And price.Close > price.Close(Smoothing)
Hold = price.Close(1)
Thresh = price.Close(Smoothing)
Check = True
Ind = price.Close(1)
Plot = Ind
Exit Function
Case <= price.Close(1) And Check = True And price.Close > Thresh
Ind = Hold
Plot = Ind
Exit Function
Case <= Thresh
Trend = "Down"
Check = False
Thresh = price.Close(Smoothing)
Ind = price.Close
Plot = Ind
Exit Function
End Select
Case = "Down"
Select Case price.Close
Case < price.Close(1) And Check = False
Thresh = price.Close(Smoothing)
Ind = price.Close
Plot = Ind
Exit Function
Case < price.Close(1) And Check = True And price.Close >= Hold
Ind = Hold
Plot = Ind
Exit Function
Case < price.Close(1) And Check = True And price.Close < Hold
Check = False
Thresh = price.Close(Smoothing)
Ind = price.Close
Plot = Ind
Exit Function
Case >= price.Close(1) And Check = False And price.Close < price.Close(Smoothing)
Hold = price.Close(1)
Thresh = price.Close(Smoothing)
Check = True
Ind = price.Close(1)
Plot = Ind
Exit Function
Case >= price.Close(1) And Check = True And price.Close < Thresh
Ind = Hold
Plot = Ind
Exit Function
Case >= Thresh
Trend = "Up"
Check = False
Thresh = price.Close(Smoothing)
Ind = price.Close
Plot = Ind
Exit Function
End Select
End Select

 

Topic: RC Indicator Returns 0.00
Posted: Friday, September 28, 2018 12:37:02 AM

The solution was that there was an undeclared number for "period" in the block diagram.  They worked with me to fix it and get it defined.

 

Thanks

Topic: RC Indicator Returns 0.00
Posted: Thursday, September 27, 2018 2:32:47 PM

Hello,

 

Having trouble with the following:

 

&#39;# ATR = indicator.Library.Average True Range
 
 
Dim Trend1 As Single
Dim Trend2 As Single
Dim Trend3 As Single
 
Trend1 = Price.Close - Price.XAVG(20)
Trend2 = Price.Close - Price.XAVG(50)
Trend3 = Price.Close - Price.XAVG(200)
 
Plot = (Trend1 + Trend2 + Trend3) / ATR.AVG(200)
 
Without the "/ATR.AVG(200)" portion it functions properly.  With that portion it returns all 0.  Any ideas as to what is going on?
 
Thank you,
Connor
Topic: Identifier Expected when I import an indicator
Posted: Tuesday, June 07, 2016 3:36:50 PM

Solved

 

I was running the above code along with some simlar code to generate an indicator that would range in values of 3, 1, -1, and 0.  Basically Elder Impulse with 3C added in as a third qualifier.  The problem was that if I coded both components of Elder Impulse and the component of 3C it would stack overflow and crash.

The solution was to just code the EI components and 3C component separately and then drag them together to do a Plot Comparison and select Add.

The end result is what I was after and doesn&#39;t seem to crash the program yet.

 

Sorry for a now useless post but maybe people can learn from my amateur fumbling around.

 

Thanks again.

Topic: Identifier Expected when I import an indicator
Posted: Tuesday, June 07, 2016 3:30:03 PM

OK

 

Thanks for getting this far.  I have fixed all the above issues by remaking the 3C in real code.

The problem I have now is that my real code indicator in the above post that is based on my remake of 3C is crashing Stockfinder everytime I try to run the code.  Seems like a stack overflow so now I&#39;m stuck again.


Thanks

Topic: Identifier Expected when I import an indicator
Posted: Monday, June 06, 2016 11:39:24 AM

Ok I&#39;ve fixed the errors coming up.  The real code doesn&#39;t like indicators described with a number in the front.  The problem I have now is that it will not plot anything.

 

&#39;|******************************************************************
&#39;|*** StockFinder RealCode Indicator - Version 5.1 www.worden.com 
&#39;|*** Copy and paste this header and code into StockFinder *********
&#39;|*** Indicator:EI
&#39;|*** Example: plot = price.close - price.close(1)
&#39;|******************************************************************
&#39;# CCC = indicator.MyLibrary.3C as F2 in  TC
 
 
Dim Elder3 As Integer
Select Case Elder3
Case CCC.XAVG(13) > CCC.XAVG(13, 1)
Elder3 = -1
Case CCC.XAVG(13) < CCC.XAVG(13, 1)
Elder3 = 1
End Select
 
plot = Elder3
Topic: Identifier Expected when I import an indicator
Posted: Monday, June 06, 2016 11:25:31 AM

I can get to the block diagram if that helps.

http://imgur.com/21pXF9r

Topic: Identifier Expected when I import an indicator
Posted: Monday, June 06, 2016 11:11:53 AM

Hello,

I&#39;m having trouble importing an indicator that someone else has written into the real code editor to use for some math etc. Long story short if the current bar is higher than the previous bar in terms of the value of this indicator I want it to return a 1 and if it is lower a -1.  That part I have worked out as I use it for other standard indicators like a moving average or a MACD histogram.

However, when I try to import this indicator it gives an "Identifier Expected" error and I haven&#39;t even written any code yet. It says it is on line 20 and 26.

My best guess is that the parameters for the indicator are being asked for but I can&#39;t get to them.  I know the indicator was done in real code before by the author but I can&#39;t seem to get to the code to look at it. If I could rewrite the code in a fresh indicator that might work. It was originally done in Telechart so not sure what the code would be now in Stockfinder.  Here&#39;s what I have though:

3C Code
So, here&rsquo;s the code. Go into TeleChart and select &ldquo;add indicator&rdquo;, then select &ldquo;custom&rdquo; and then select &ldquo;cumulative&rdquo;. I always plot 3C in the top window with price. Make sure you check &ldquo;visible&rdquo; and set the smoothing average to &ldquo;1&rdquo;, which is no smoothing so simple/expo won&rsquo;t matter as there is no smoothing. Then in the &ldquo;up condition&rdquo; box, put this code: tsv55>tsv55.10 Then in the &ldquo;down condition&rdquo; box, use this code: tsv55 
The code I gave you is a bit of a longer-term indicator, good for weekly, daily and hourly charts. It&rsquo;ll work good for the minute charts as well, however I prefer to use something a bit faster. For intraday charts, I&rsquo;ve been using these codes in the up condition/down condition boxes: tsv2>tsv2.20 / tsv2 &rdquo;=greater than and the &ldquo;.20&rdquo; =20 bars ago. So feel free to play with the code and see what you come up with, the basic premise is the indicator is looking at its position now as compared with its position (x) number of bars ago, and thus a sort of trend. A longer TSV will better reflect a long-term trend while a shorter TSV will better reflect net accumulation/distribution, but it isn&rsquo;t as great at looking at longer-term trends. 
 
1 hour
 
Cumulative(tsv>tsv.10,tsv<tsv.30,1+1)1 Period
 
Any help you can provide would be fantastic.

Thank you,
Connor

 

 

Topic: Bars since higher close or lower close
Posted: Thursday, March 19, 2015 5:56:36 PM

Thanks looks like that did the trick.

Topic: Bars since higher close or lower close
Posted: Tuesday, February 24, 2015 3:35:41 PM

Hello,

I&#39;m trying to code an indicator to plot the number of bars since there was a close higher than the current close in the case of an up candle or number of bars since there was a close lower than the current close in the case of a down candle.

I&#39;m pretty new to coding and can&#39;t seem to get it to loop and do a count of the number of bars.

Thank you