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 |

converting custom indicator from TC to Blocks Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
accendo
Posted : Saturday, August 16, 2008 10:14:30 PM
Registered User
Joined: 7/2/2008
Posts: 23
How do I get these two custom indicators into Blocks. L<((2.95*MINL15.7)-MAXH7.3)/2 AND STOC50.3<10 AND L((3.05*MAXH15.7)-MINL7.3)/2 AND H>H1 AND STOC50.3>50
Bruce_L
Posted : Monday, August 18, 2008 1:11:04 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
For L<((2.95*MINL15.7)-MAXH7.3)/2 AND STOC50.3<10, you may wish to try the following RealCode Condition:

Static Avg3Stoc50 As Single
If isFirstBar Then Avg3Stoc50 = 0
If CurrentIndex >= 50 Then Avg3Stoc50 += _
        100 * (Price.Last - Price.MinLow(50)) / _
        (Price.MaxHigh(50) - Price.MinLow(50)) / 3
If CurrentIndex >= 53 Then Avg3Stoc50 -= _
        100 * (Price.Last(3) - Price.MinLow(50,3)) / _
        (Price.MaxHigh(50,3) - Price.MinLow(50,3)) / 3
If CurrentIndex >= 52 Then
    If Price.Low < (2.95 * Price.MinLow(15,7) - _
        Price.MaxHigh(7,3)) / 2 And _
        Avg3Stoc50 < 10 Then Pass
Else
    SetIndexInvalid
End If

Unfortunately, L((3.05*MAXH15.7)-MINL7.3)/2 AND H>H1 AND STOC50.3>50 doesn't make sense in TeleChart's Personal Criteria Formula Language. It is the L(( portion without anything between the L and the opening parenthesis that is the problem.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
accendo
Posted : Monday, August 18, 2008 5:55:10 PM
Registered User
Joined: 7/2/2008
Posts: 23
Thanks Bruce,Let me correct my mistake. It should be:H>((3.05*MAXH15.7)-MINL7.3)/2 AND H>H1 AND STOC50.3>50
accendo
Posted : Monday, August 18, 2008 6:04:09 PM
Registered User
Joined: 7/2/2008
Posts: 23
I am sorry, could I also get the additional code for the color, The first code you already help with should be Green and the second should be red.Michael
accendo
Posted : Monday, August 18, 2008 6:06:12 PM
Registered User
Joined: 7/2/2008
Posts: 23
Error Message: Name 'Pass' is not declared.
Bruce_L
Posted : Tuesday, August 19, 2008 9:23:00 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
QUOTE (accendo)
Error Message: Name 'Pass' is not declared.

It reads like you are using this as a RealCode Paint Brush or RealCode Indicator instead of as a RealCode Condition. Select RealCode Editor | Condition to bring up the correct window in which to paste the RealCode.

For H>((3.05*MAXH15.7)-MINL7.3)/2 AND H>H1 AND STOC50.3>50, you may wish to try the following RealCode Condition:

Static Avg3Stoc50 As Single
If isFirstBar Then Avg3Stoc50 = 0
If CurrentIndex >= 50 Then Avg3Stoc50 += _
        100 * (Price.Last - Price.MinLow(50)) / _
        (Price.MaxHigh(50) - Price.MinLow(50)) / 3
If CurrentIndex >= 53 Then Avg3Stoc50 -= _
        100 * (Price.Last(3) - Price.MinLow(50,3)) / _
        (Price.MaxHigh(50,3) - Price.MinLow(50,3)) / 3
If CurrentIndex >= 52 Then
    If Price.High > (3.05 * Price.MaxHigh(15,7) - _
        Price.MinLow(7,3)) / 2 And _
        Price.High > Price.High(1) And _
        Avg3Stoc50 > 50 Then Pass
Else
    SetIndexInvalid
End If

You can select the Color you wish to use for the Condition by changing the Condition Color at the bottom of the RealCode Editor (and you can Drag and Drop the Condition from the Condition Palette to the Chart to Plot it).

You can color other Plots using a Condition by right-clicking on the Plot you wish to Paint, selecting New Paint Brush (or Edit Paint Brush if it already has a Paint Brush) and then Dragging and Dropping the Condition from the Condition Palette into the Conditional Colors tab of the Paint Brush.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
accendo
Posted : Tuesday, August 19, 2008 7:18:47 PM
Registered User
Joined: 7/2/2008
Posts: 23
OK Bruce,

You definitely rock!  Last question.  In TC, it plots a green/red line from bottom to the top of the chart.  It appears that in blocks, it just puts a little line at the bottom of the chart.  Any way to make it more distinguishable.

thanks again,

Michael
Bruce_L
Posted : Wednesday, August 20, 2008 8:50:55 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You could create RealCode Indicators instead of RealCode Conditions. L<((2.95*MINL15.7)-MAXH7.3)/2 AND STOC50.3<10 becomes:

Static Avg3Stoc50 As Single
If isFirstBar Then Avg3Stoc50 = 0
If CurrentIndex >= 50 Then Avg3Stoc50 += _
        100 * (Price.Last - Price.MinLow(50)) / _
        (Price.MaxHigh(50) - Price.MinLow(50)) / 3
If CurrentIndex >= 53 Then Avg3Stoc50 -= _
        100 * (Price.Last(3) - Price.MinLow(50,3)) / _
        (Price.MaxHigh(50,3) - Price.MinLow(50,3)) / 3
If CurrentIndex >= 52 Then
    If Price.Low < (2.95 * Price.MinLow(15,7) - _
        Price.MaxHigh(7,3)) / 2 And _
        Avg3Stoc50 < 10 Then
        Plot = 100
    Else
        Plot = 0
    End If
Else
    Plot = Single.NaN
End If

While H>((3.05*MAXH15.7)-MINL7.3)/2 AND H>H1 AND STOC50.3>50 becomes:

Static Avg3Stoc50 As Single
If isFirstBar Then Avg3Stoc50 = 0
If CurrentIndex >= 50 Then Avg3Stoc50 += _
        100 * (Price.Last - Price.MinLow(50)) / _
        (Price.MaxHigh(50) - Price.MinLow(50)) / 3
If CurrentIndex >= 53 Then Avg3Stoc50 -= _
        100 * (Price.Last(3) - Price.MinLow(50,3)) / _
        (Price.MaxHigh(50,3) - Price.MinLow(50,3)) / 3
If CurrentIndex >= 52 Then
    If Price.High > (3.05 * Price.MaxHigh(15,7) - _
        Price.MinLow(7,3)) / 2 And _
        Price.High > Price.High(1) And _
        Avg3Stoc50 > 50 Then
        Plot = 100
    Else
        Plot = 0
    End If
Else
    Plot = Single.NaN
End If

The Indicators Plot 0 for False and 100 for True like what would happen with a Custom Percent True Indicator in TeleChart. If you Plot them in the same Pane as another Indicator, you will most likely want to Plot them on their own Scale (right-click on the Indicator and select Scale With | On Own Scale).

-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.