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


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

pass cross and plot two lines, can on call other two? Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
jrf-word
Posted : Tuesday, July 27, 2010 1:56:57 PM
Registered User
Joined: 7/19/2010
Posts: 5

bruce l.: you are correct i left out the "="!  i am trying to master basic! it's new for me!

please look at code below. i want to know how to write indicater that will screen (pass) and also draw
(plot)? can pass CALL a plot that draws two lines; avg20 and avg50?
is there an error in skeep first 49 below, how about avg50 w/ offset of 1?

'|*****************************************************************|
'|*** StockFinder RealCode Condition - Version 4.9
'|*** Copy and paste this header and code into StockFinder *********
'|*** Condition:Crossing MA
'|******************************************************************
If currentindex < 50 Then
 Me.setindexinvalid   '* skip first 49? price.avg(50,1) sum how many??
End If
'* else ?? do we need 51 bars to sum price.AVG(50,1)???
If price.AVG(20, 1) < price.AVG(50, 1) AndAlso price.AVG(20) >= price.avg(50) Then pass

'* 1) currentindex = sys count, left to right, old to current; 0k?
'* 2) isfirstbar = y/n, first (0) bar on left; ok?
'* 3) if summation or avg etc. start proc. at "currentindex" + 1; ok?
'*    (ex) for avg=50; if curr < 50 then me.setindexinvalid (skip?); ok?
'**questions**
'* some indicators (macd) PLOT two lines; PASS has no lines!
'* 1) how do i call my PLOT code from my PASS code to draw line showing what i just
'*    selected; avg20 crosing avg50?
'*--------------------------------------------------------------------------------------

Bruce_L
Posted : Tuesday, July 27, 2010 3:28:05 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Although I've read through your post several times, I do not understand the RealCode or questions being asked. Here are some statements that may or may not directly answer your questions but which should hopefully it least be related and head you in the right direction.

Conditions and Indicators are two different things with different functions. These functions cannot currently be mixed and matched in the same RealCode.

A Condition returns True, False or nothing (the nothing is returned using SetIndexInvalid).

An Indicator returns a Single Value, a Bar or nothing (the nothing is returned using Plot = Single.NaN). The only way it can return more than one Value is by returning Bar data. When returning Bar data, you must return exactly four Values per Bar.

To Plot two Lines, you would need to use two Indicators.

Price.AVG(50, 1) will not have enough data to calculate until CurrentIndex = 50 (the index is zero based).

RealCode for Real People: Indicators
Writing Conditions in RealCode

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.