Registered User Joined: 7/30/2008 Posts: 30
|
can I export the data to an Excel file from three different time frames in one layout in such a way that it will give me "1" or "-1" depending which rule is true?
thank you
another question is as follows. let us say I have got three different time frames in one layout and I need assign "-1" if some rules which are true and "1" if other rules are true. can I have an indicator which makes a sum of "1" and "-1" and plots the result?
thank you
how can I count the bars when a rule is true?
thank you
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
QUOTE (sasworldwide) can I export the data to an Excel file from three different time frames in one layout in such a way that it will give me "1" or "-1" depending which rule is true?
If you Export the Rules directly, the results will be True or False instead of 1 or -1. You could create RealCode Indicators based on the Rules that would return 1 or -1 instead however.
'# SC = condition.ScanCondition
If SC.Value = True Then
Plot = 1
Else If SC.Value = False Then
Plot = -1
Else
Plot = Single.NaN
End If
An Export is for a Chart, not a Layout, so if you want all of the Rules with different Time Frames to Export in a single file, you would need to have multiple Rules with different Time Frames in the same Chart.The following topics have examples of Block Diagram based Indicators with adjustable Time Frames:
rules based on different time frames
Seeking Price Rule Based Upon Price Bars With 2 Different Time Frames
Multiple Time Frame
I've also attached a Chart with Drag and Drop Rules based on Price History with Time Frame Indicators that does in fact Export all of the results to a single file. You should be able to Open the attached Chart directly into a running copy of StockFinder.
QUOTE (sasworldwide) another question is as follows. let us say I have got three different time frames in one layout and I need assign "-1" if some rules which are true and "1" if other rules are true. can I have an indicator which makes a sum of "1" and "-1" and plots the result?
You would again want to have all of the Time Frames in the same Chart. Once this is done, you could Drag and Drop the Rules into a RealCode Indicator and output the Sum at each Bar:
'# Thirty = condition.ScanCondition
'# Daily = condition.ScanCondition.2
'# Hourly = condition.ScanCondition.3
Dim Sum As Integer = 0
If Thirty.Value = True Then Sum += 1
If Thirty.Value = False Then Sum -= 1
If Daily.Value = True Then Sum += 1
If Daily.Value = False Then Sum -= 1
If Hourly.Value = True Then Sum += 1
If Hourly.Value = False Then Sum -= 1
Plot = Sum
QUOTE (sasworldwide) how can I count the bars when a rule is true?
What are you counting? How many times it is True in a row? How many times it is True during the history of the data being calculated? How many times it is True over a specific period of time?Attachments: sasworldwide42552.sfChart - 86 KB, downloaded 566 time(s).
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
Another approach, assumming all thee indicators are on the same chart would be to only export when any of then are true and export all 3 values plus the sum.
# Thirty = condition.ScanCondition
'# Daily = condition.ScanCondition.2
'# Hourly = condition.ScanCondition.3
Dim Sum As Integer = 0
...
... compute sum here
...
'
' reduce the exports to only export when the sum is equal whatever
'
if sum = whatever then
Plot = Sum
label = Thirty.value & "," & Daily.Value & "," & Hourly.Value
else
plot. = single.NAN
endif
This will export:
symbol,date,time,plot,30 value, daily value, hourly value
only when whatever is satisfied.
|