How to change Signal to an Indicator with alert function  [SOLVED]

Questions about MultiCharts and user contributed studies.
trim
Posts: 78
Joined: 22 May 2013
Has thanked: 19 times
Been thanked: 2 times

How to change Signal to an Indicator with alert function

Postby trim » 16 Jun 2015

I have two MC signals that I would like to use as an Indicator so I can use the email alert function of an Indicator.

This is the signal script...

inputs: Price( Close ), FastLength( 4 ), MedLength( 9 ), SlowLength( 18 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;

var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, MedLength ) ;
var2 = AverageFC( Price, SlowLength ) ;

Condition1 = Price > var0 and var0 > var1 and var1 > var2 ;

condition2 = CurrentBar > 1 and Condition1 and Condition1[1] = false;
if condition2
then
Buy ( "MA3CrsLE" ) next bar at market ;


I would like to,remove the "Buy ( "MA3CrsLE" ) next bar at market ;" code in this signal and have it replcaed with a line of code that produces an Alert..

thank you

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to change Signal to an Indicator with alert function

Postby TJ » 16 Jun 2015

I have two MC signals that I would like to use as an Indicator so I can use the email alert function of an Indicator.
This is the signal script...
inputs: Price( Close ), FastLength( 4 ), MedLength( 9 ), SlowLength( 18 ) ;
variables: var0( 0 ), var1( 0 ), var2( 0 ) ;
var0 = AverageFC( Price, FastLength ) ;
var1 = AverageFC( Price, MedLength ) ;
var2 = AverageFC( Price, SlowLength ) ;
Condition1 = Price > var0 and var0 > var1 and var1 > var2 ;
condition2 = CurrentBar > 1 and Condition1 and Condition1[1] = false;
if condition2
then
Buy ( "MA3CrsLE" ) next bar at market ;
I would like to,remove the "Buy ( "MA3CrsLE" ) next bar at market ;" code in this signal and have it replcaed with a line of code that produces an Alert..
thank you
This is a good place to start:
viewtopic.php?f=16&t=6929

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to change Signal to an Indicator with alert function

Postby TJ » 16 Jun 2015

ps:

[FAQ] How to Post Codes (that people can read)
viewtopic.php?f=16&t=11713

trim
Posts: 78
Joined: 22 May 2013
Has thanked: 19 times
Been thanked: 2 times

Re: How to change Signal to an Indicator with alert function

Postby trim » 16 Jun 2015

Thanks TJ here is the script now in a code box, hope this makes it easier for someone to help me...

Code: Select all

inputs:
BollingerPrice( Close ),
TestPriceLBand( Close ),

Length( 20 ),
NumDevsDn( 2 ) ;

variables:
var0( 0 ) ;

var0 = BollingerBand( BollingerPrice, Length, -NumDevsDn ) ;

condition1 = CurrentBar > 1 and TestPriceLBand crosses over var0 ;
if condition1 then

Buy ( "BBandLE" ) next bar at var0 stop ;

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: How to change Signal to an Indicator with alert function  [SOLVED]

Postby Henry MultiСharts » 17 Jun 2015

Hello trim,

Alerts are generated when the Alert reserved word is triggered in your code. Both Indicators and signals can generate an alert now. Please review the help guide for Alert keyword to learn how to utilize it in your code.


Return to “MultiCharts”