jimmyg |
Member
|
Registered User |
|
|
|
|
Gender: |
|
Wednesday, November 10, 2010 |
Wednesday, December 22, 2010 7:07:23 PM |
54 [0.02% of all post / 0.01 posts per day] |
|
Bruce,
Thanks for your thoughts!
So...
Static Variables are pfa......... Do they require the ...." = Single.NaN" initialization?
EX:
If isFirstBar Then
PointScore = Single.NaN
For i As Integer = 0 To 1
DayOpen(i) = Single.NaN
DayHigh(i) = Single.NaN
DayLow(i) = Single.NaN
DayClose(i) = Single.NaN
Next
DayCount = 0
Else.....................................................................
Another concern is house keeping related to this.... I want to make sure I'm not using more variables than needed, and that computer memory doesn't get used up by spawning storage spaces for pfa's and that it cleans the memory up well when execution is finished...
For someone who's " not a programmer " you sure seem to be "clevor" !!!!
As always,
Thanks in advance for your thoughts...
jimg
back to tinkerin....
|
Bruce,
I've been tinkering....with this indicator.
It really is exciting to work with....
Please consider the following (same indicator construct as above):
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Static PointScore As Single ' POINTSCORE - VALUE TO PLOT / (WC SORT)
Static BARNUM As Single ' BAR ITERATION COUNTER
Static YDRANGE As Single ' YESTERDAY'S PRICE RANGE
Static DayOpen(1) As Single ' ????
Static DayHigh(1) As Single ' THESE DAYxxx ARRAY VARIABLES
Static DayLow(1) As Single ' ARE??? NOT PFA (PULLED FROM AIR)
Static DayClose(1) As Single '
Static DayCount As Integer '???? WHAT DO YOU CALL THESE ?????
'
' PIVOT POINTS
Static PP As Single 'MORE OF MY PFA VARIABLES......
Static R1 As Single
Static R2 As Single
Static R3 As Single
Static S1 As Single
Static S2 As Single
Static S3 As Single
?????' DO MY PFA VARIABLES NEED TO BE INSTANCIATED BELOW....
'????? LIKE THESE DAYxxx VARIABLES?
If isFirstBar Then
PointScore = Single.NaN
For i As Integer = 0 To 1
DayOpen(i) = Single.NaN
DayHigh(i) = Single.NaN
DayLow(i) = Single.NaN
DayClose(i) = Single.NaN
Next
DayCount = 0
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
PointScore = 0 ' AT THIS POINT IN EXECUTION OF THIS INDICATOR,
BARNUM = 0 'WE ARE AT THE START OF TODAY....
DayOpen(1) = DayOpen(0) '
DayOpen(0) = Price.Open '
DayHigh(1) = DayHigh(0) '
DayHigh(0) = Price.High '
DayLow(1) = DayLow(0) '
DayLow(0) = Price.Low '
DayClose(0) = Price.Last '
DayClose(1) = Price.Last(1) '
DayCount += 1 ' SO I INITIALIZE MY PP'S... ETC....
'... PIVOT POINTS STATIC VARIABLE VALUES....
PP = (DayHigh(1) + DayLow(1) + DayClose(1)) / 3
' Me.Log.Info(“Symbol: " + CurrentSymbol + " PP = " + PP.ToString())
'''''''''''' END OF MY PFA VARIABLE SETTING....SETUP FOR TODAY'S EXECUTION ON THE WATCHLIST.
Else
''''' I NEED TO UNDERSTAND THESE DAYxxx THINGS.... IS THIS INHERITANCE? FROM A ???????
'''' WHAT'S THE TERMINOLOGY THAT YOU USE TO DESCRIBE THESE?
DayHigh(0) = System.Math.Max(DayHigh(0), Price.High)
DayLow(0) = System.Math.Min(DayLow(0), Price.Low)
DayClose(0) = Price.Last
End If
If DayCount >= 2 Then
BARNUM += 1
' IT IS TODAY AND WE ARE "LIVE" IN THE WATCHLIST... SO
'============= ALL BAR CALCULATIONS ======================
IF BARNUM >= 1 AND BARNUM < = 4 ' I'M ONLY WANTING THIS TO EXECUTE FOR THE FIRST
''' INCREMENT POINTSCORE ' 20 MINUTES OF THE DAY AND ...
IF POINTSCORE >= 999
I AM LOGGING INFO DEBUG MESSAGES FOR THEORETICAL ORDERS.....
BARNUM, PRICE, TARGET, ETC.
ENDIF
End If 'END OF ALL BAR CALCULATIONS ===============================
Plot = PointScore
Else
Plot = Single.NaN
End If
========================================================================
SO, after the first 20 minutes of the day, this thing has done it's thing....
The values are listed in the watchllist column (WC) and the list is sorted. VERY WELL!!!!
Actually, I am logging each time the watchlist sort is done on this WC.... so it's writing multiple orders as the pointscore is incremented above 999 on any particular pass (oops... BAR).
I'm wondering if there is some other type of variable that could be used for each symbol to say once is enough.... I think this is "persistance" or "global" or something...
I'm still having trouble understanding how to manipulate variables... and the running of multiple passes in the watchlist.
Can you help me on this??? 1.
I may be trying to do something that an indicator was not designed to do, but some more questions please...
2. Can I write text to another file (other than the debug log) during execution?
3. Can I read another file during execution.
4. Can I call other VB.NET gadgets from within this thing?
What Can and Can't I do with this?
5. Could this actually place an order at my broker (OE).
Possibilities seem endless.... What are your thoughts?
As Always,
Thanks for your help...
jimg
|
Bruce,
Quote:
The optimization used to determine how much data to use in a WatchList requires running the the calculations multiple times for at least one symbol to determine the minimum amount of data that can be used.
I was hoping that you would say something like that!!!
So Far, So Good !!!!
I'll go back to tinkering....
Thanks again for ALL your help!
jimg
|
Bruce,
Very Good Analysis / discussion!
It looks like the PriceData method is just what I've been concerned about....
Also, on my first test, my FirstClass seemed to run slower than just an indicator that did the same thing...
SOooo, Please look at the following to tell me if I'm on the right track here....
Static PointScore As Single
Static BARNUM As Single
Static YDRANGE As Single
Static DayOpen(1) As Single
Static DayHigh(1) As Single
Static DayLow(1) As Single
Static DayClose(1) As Single
Static DayCount As Integer
' PIVOT POINTS
Static PP As Single
Static R1 As Single
Static R2 As Single
Static R3 As Single
Static S1 As Single
Static S2 As Single
Static S3 As Single
If isFirstBar Then
PointScore = Single.NaN
For i As Integer = 0 To 1
DayOpen(i) = Single.NaN
DayHigh(i) = Single.NaN
DayLow(i) = Single.NaN
DayClose(i) = Single.NaN
Next
DayCount = 0
Else If Price.DateValue.DayOfYear <> Price.DateValue(1).DayOfYear Then
PointScore = 0
BARNUM = 0
DayOpen(1) = DayOpen(0)
DayOpen(0) = Price.Open
DayHigh(1) = DayHigh(0)
DayHigh(0) = Price.High
DayLow(1) = DayLow(0)
DayLow(0) = Price.Low
DayClose(0) = Price.Last
DayClose(1) = Price.Last(1)
DayCount += 1
'... PIVOT POINTS STATIC VARIABLE VALUES....
PP = (DayHigh(1) + DayLow(1) + DayClose(1)) / 3
Me.Log.Info(“Symbol: " + CurrentSymbol + " PP = " + PP.ToString())
' R1 = (PP * 2) - YDL
R1 = (PP * 2) - DayLow(1)
Me.Log.Info(“Symbol: " + CurrentSymbol + " R1 = " + R1.ToString())
' R2 = PP + (YDH - YDL)
R2 = PP + (DayHigh(1) - DayLow(1))
Me.Log.Info(“Symbol: " + CurrentSymbol + " R2 = " + R2.ToString())
' R3 = PP + ((YDH - YDL) * 2)
R3 = PP + ((DayHigh(1) - DayLow(1)) * 2)
Me.Log.Info(“Symbol: " + CurrentSymbol + " R3 = " + R3.ToString())
' S1 = (PP * 2) - YDH
S1 = (PP * 2) - DayHigh(1)
Me.Log.Info(“Symbol: " + CurrentSymbol + " S1 = " + S1.ToString())
' S2 = PP - (YDH - YDL)
S2 = PP - (DayHigh(1) - DayLow(1))
Me.Log.Info(“Symbol: " + CurrentSymbol + " S2 = " + S2.ToString())
' S3 = PP - ((YDH - YDL) * 2)
S3 = PP - ((DayHigh(1) - DayLow(1)) * 2)
Me.Log.Info(“Symbol: " + CurrentSymbol + " S3 = " + S3.ToString())
Else
DayHigh(0) = System.Math.Max(DayHigh(0), Price.High)
DayLow(0) = System.Math.Min(DayLow(0), Price.Low)
DayClose(0) = Price.Last
End If
If DayCount >= 2 Then
'MY STUFF GOES HERE
BARNUM += 1
'============= FIRST BAR CALCULATIONS ======================
If BARNUM = 1
'..... ONLY GIVE POINTS TO STOCKS THAT ARE GOING UP IN PRICE FROM YESTERDAY
If PRICE.Last > PRICE.LAST(1) Then
POINTSCORE += 1
'...VOLUME SURGE POINTS....
If VS.Value > 1 Then PointScore += VS.Value
'... POINTS FOR OPENING LOWER AND COMING BACK UP
' If PRICE.Open < PRICE.Close(1) Then POINTSCORE += 1
End If
End If
'END OF FIRST BAR CALCULATIONS ===============================
'TO HERE
Plot = PointScore
Else
Plot = Single.NaN
End If
=================================================================
I'm not sure if I put the PP calcs in the right place..... When I first ran the above.... with just the PP calculation active and writing to the log... It produced about 5 different log entries....
Multiple log entries for 1 value don't make me feel good about this.... Am I doing something wrong???
I did get it to work though, and it did verify all the PP values on my 5 min chart... except R3 and S3... which appear to have some other formula calculating them on the chart.... I'd like to fix (resolve ) that.
But, ALL SAID SO FAR, this looks promissing!
I just want to verify (or correct) the structure of the code above so I can continue building the PointScore...
As Always, Thanks for your help!!
Jimg
|
Bruce,
Your Quote"
Then again, you may be better of recreating the Condition within the Indicator than importing it.
"""""
I think this is the method (no pun intended...) that I've been using (or wanting to use) when I'm coding this so far as a first 30 minutes of the day indicator......... five minutes to a bar, each bar executing it's own code...
Anyway, I think the theory is well worth pursueing.
I'll tinker tonight....
Thanks again!!!!
|
Yes to any ... maybe....
I also use a weekly chart... with the same "Up2InARow" condition that I Plot on my daily chart as just a special color price bar... Some other conditions that I've programmed onto the charts use colored arrows to plot...
Right now I can see myself using 4 charts to view a stock...
My layout has:
(1) The "Main Chart" which is set to 1 or 2 minutes...
(2) The second Tabbed Chart (5 Minute) is what I'm really using as my main viewing chart... with conditions to paint some arrows and/or color the bars... I've been doing all my development here from this chart... so far....
(3) The Third chart I use is just a Daily... so far with just the "Up2InARow" condition painting the bars...
(4) Chart 4 is just the Weekly version of #3.
This gives me a pretty good picture of where this stock has been..... I rarely look at the "Main Chart" which is the 1 or 2 minute chart.
Any direction on the layout will be appreciated....
So Here's the results of the trial run .....
The code compiled, and plotted on my 5min chart....after creating a realcode indicator as instructed.... I called it "First Class".....
Then I go to the watchlist (Russ 2000) and "add a data column" for the FirstClass indicator.... it seems to populate rather quickly.... but the values don't match the chart.... So, I edit the column to a bar interval of 5 min... and it takes off recalculating..... Again, seemingly fairly fast as I see it recalculating down the column... When I sorted on the data column, though... That took about 5 minutes to recalculate...
So I've set the sort frequency to "ONCE".
It DID WORK!!!!! Encouraging to say the least..... But, I have to incorporate my other calculations, so I'm wondering if that is going to slow it down (how much) further..... I'll be tinkering to see...
I guess I'm wondering about the watchlist updating... and sorting at the first of the day when the data stream comming in is high and TIME IS Of the Essence....
In my logic, I'm testing for "IF 1st bar" do something, and IF 2nd Bar.... add/or/subtract ... etc.
so I'm wondering about the SORT execution "synchronization" in the watchlist along with the CODE execution "synchronization" that my computer will perform...... SO MUCH SYNCHRONIZING..... Almost mind boggling!!
It all seems to me to boil down to TWO speed concerns..... The data stream comming in.... and the speed at which my computer can execute the code and sort the watchlist.....
If I assume that at 9:36 the data stream has updated the data base up through 9:35, would I be wrong???
And If the data is there in the database, I assume that I could get a faster computer to run the code???? if needed.
What do you think???
As always, thanks for your help!
JimG
|
Bruce,
Thanks for the guidance!!!!!
Per Question 1:
I really don't want this thing on a chart screen if I know it works.... As I've been testing though, it's been helpful.
Per Question 2:
I'm having visions of grandure.... IE: This thing should work!!!!!! (if my code doesn't cause it to blow up...)
Per Question 3:
So, I can set.... AutoLoop = False 'OR True.......
to have the watchlist (do it's work) either way...
AndSo...
synchronization of conditions is a concern....EX: pivot point calculation using yesterday's values
Here's where I think my code needs some "Class" added....
Say I have this condition called "Up2InARow" that I use on a Daily chart beside my 5 min chart, and I want to incorporate that condition into this indicator...
Would that in and of itself mean that I need to go to a Class Object, or could I still just use an indicator...
|
Bruce,
In this last example... I would start building my point score inside the ....
If DayCount >= 2 Then
Do PointScore calculation here...
Plot PointScore
Else
Plot = Single.NaN
End If
So... Questions:
1. Wouldn't this calculate for each day of data in the data base... If so, I think we need to limit to...
If DayCount = ????? today
2. Would this (indicator) update the score for each stock in the Watchlist if it was an existing watchlist column at the beginning of the day?
3. If I bring up another watch list and add this indicator as a data column, (1) would it populate the values for each stock correctly, and (2) would the watchlist be able to sort based on the data column?
I'm also starting to read about Classes and wondering if I need to be incorporating this logic into a class object .... If it would work better....
What do you think?
|
Bruce,
Here's what I have envisioned.... At the first of the day, during the 1st 30 minutes of trading.... I want to isolate stocks based on whatever I can program into this THING.... (THING being a condition, indicator, or class... etc.)..
The only way I know of... to isolate these stocks is through manipulating a watchlist. So whatever this THING is,... It has to be able to work consistently with a watchlist. I'm using the Russell 2000.
Please Correct me If I'm wrong so far.... I want to manipulate watchlists to isolate stocks that exhibit some behavior. And as always with programming, Speed is of major concern.
So, to isolate these stocks, I'd like to be able to use whatever data is available...
So far, I've been constraining this to 5 min bars of (today's) data, which is ok... so far... but I do need access to yesterday's data to do pivot points... etc.
This brings into context the idea of Daily Data Bars.... And my code (and I) get lost here....in this indicator.
EX: I need yesterday's high, low, close, and open... values to do calculations for variables PP, R1, etc.
Of course, there are lots and lots of other things that might factor into this Score Value, that I am trying to assign to each stock in the watchlist.... So the watchlist has to be able to use the code that I give it (creating a data column) with consistency and speed.
What are your thoughts so far? ...
|
AWESOME.....
I was up till 3:00 AM this morning trying to figure this out....
SOooo , the code is good... but somehow, I had the Volume Surge Indicator messed up on my chart....
At least I know I'm on the right track.... Look at DHX NOW
AndAlso.... the concept of "linked to the chart" sounds like something I'd want to avoid in future RC indicators that I might construct....
I do have those Pivot Points of the chart though, and I'd like to be able to test values against them... PP.value, R1.value.... etc.... When I tried to use those last night, I WAS WARNED by the compiler, and I crashed the SF 5 pgm. Ended up deleting the indicator file from the C: drive and re-wrote it as above.
Any thoughts on this?
Your help is GREATLY APPRECIATED!!!!!!!
Thanks,
JIMG
|
|