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 1,343 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #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?
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
Memorandum Watch: How the 60-Day MOU Framework Makes May …
Prediction Markets & Event Contracts
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #2 (permalink)
 
Tripken's Avatar
 Tripken 
Knoxville, TN/USA
Legendary Market Wizard
 
Experience: Beginner
Platform: TradeStation
Broker: TradeStation
Trading: ES
Frequency: Several times daily
Duration: Minutes
Posts: 641 since Feb 2010
Thanks Given: 1,750
Thanks Received: 1,428

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: 30



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


© 2026 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 - Downloads - Top
no new posts