NexusFi: Find Your Edge


Home Menu

 





EasyLanguage - Alert trigger


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one abev with 1 posts (1 thanks)
    2. looks_two chilies with 1 posts (0 thanks)
    3. looks_3 Tripken with 1 posts (1 thanks)
    4. looks_4 bfulks with 1 posts (0 thanks)
    1. trending_up 427 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

EasyLanguage - Alert trigger

  #1 (permalink)
chilies
Houston, Texas
 
Posts: 1 since Mar 2023
Thanks Given: 2
Thanks Received: 0

Hello, Im having trouble with the following code
"
{ alert criteria }
if AlertEnabled then
begin
if MAA1 crosses over MAA2 and MAA1 crosses over HullMovingAvg then
Alert( !( "Bullish alert" ) )
else if MAA1 crosses under MAA2 and MAA1 crosses under HullMovingAvg then
Alert( !( "Bearish alert" ) );
end;
"

I've combined three indicators into one and have attempted to have an alert sent to me when the variable MAA1 crosses over MAA2 and HullMovingAvg. usually they do not cross simultaneously so that may be the cause of my problem.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
REcommedations for programming help
Sierra Chart
Exit Strategy
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 
Tripken's Avatar
 Tripken 
Knoxville, TN/USA
Market Wizard
 
Experience: Beginner
Platform: TradeStation
Broker: TradeStation
Trading: ES
Frequency: Several times daily
Duration: Minutes
Posts: 624 since Feb 2010
Thanks Given: 1,573
Thanks Received: 1,368

Hi, here's an example of several conditions being met on a 3 line MA cross.

Perhaps it will help you. It's from the TS studies library. I'm no coder but like messing around with EL.

{ Alert criteria }
if Displace <= 0 then
begin
Condition1 = Price > FastAvg and FastAvg > MedAvg and MedAvg > SlowAvg ;
if Condition1 and Condition1[1] = false then
Alert( "Bullish alert" )
else
begin
Condition2 = Price < FastAvg and FastAvg < MedAvg and MedAvg < SlowAvg ;
if Condition2 and Condition2[1] = false then
Alert( "Bearish alert" ) ;
end ;
end ;
end ;

Reply With Quote
Thanked by:
  #3 (permalink)
abev
seattle washington
 
Posts: 75 since Feb 2019
Thanks Given: 11
Thanks Received: 29



chilies View Post
I've combined three indicators into one and have attempted to have an alert sent to me when the variable MAA1 crosses over MAA2 and HullMovingAvg. usually they do not cross simultaneously so that may be the cause of my problem.

Yep, the "and" in the IF statement means that both criteria must be true on the same bar for the entire IF statement to be true. You'll need to separate the two conditions. BTW, you might find the reserved word "Condition" to be helpful.

Reply With Quote
Thanked by:
  #4 (permalink)
 bfulks 
Boston MA
 
Experience: Advanced
Platform: TradeStation
Trading: Stocks and options
Posts: 24 since Aug 2022
Thanks Given: 2
Thanks Received: 4

The two will rarely cross on the same bar. This code should be close to what you need.

{ alert criteria }

Vars: MACross(0), HullCross(0);
if AlertEnabled then
begin

if MAA1 >= MAA2
then MACross = +1
else MACross = -1;

if MAA1 >= HullMovingAvg
then HullCross = +1
else HullCross = -1;

if MACross + HullCross crosses over +1.5 then
Alert( !( "Bullish alert" ) );

if MACross + HullCross crosses under -1.5 then
Alert( !( "Bearish alert" ) );

end;

Reply With Quote




Last Updated on April 25, 2023


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts