Store value in variable when emas crossover easy language - futures io
futures io



Store value in variable when emas crossover easy language


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,293 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Store value in variable when emas crossover easy language

(login for full post details)
  #1 (permalink)
Carlera
Colombia
 
 
Posts: 6 since Mar 2021
Thanks: 1 given, 1 received

Hi traders,

I need your help to store a value when a condition is true and use it value during the code
For example

1. When crossover Ema 200 and Ma89 then
2. Store the high Value in a variable to use it in any moment the code.
3. Draw a horizontal line from store high value to the next crossover.,

Thanks for your help.

Carlos

Reply With Quote

Can you help answer these questions
from other members on futures io?
Tick counter that works with directions?
NinjaTrader
Take Profit/ Tpx during crypto futures trading
Crypto Futures
Emini Trading Levels
Emini and Emicro Index
 
 
(login for full post details)
  #2 (permalink)
Kolnidrei
Lyon/France
 
 
Posts: 19 since Aug 2012
Thanks: 1 given, 13 received

hi
 
Code
Inputs:
Price(Close),
PeriodShort(89),
PeriodLong(200),
width(2);
vars:
w(0),plotvalue(0),color(white);

value1 = Average(Price,PeriodShort);
value2 = XAverage(Price,PeriodLong);
condition1 = value1 crosses above value2;
condition2 = value1 crosses below value2;
if condition1 then begin
plotvalue = L;
color = red;
end;
if condition2 then begin
plotvalue = H;
color = green;
end;
if plotvalue <> 0 then begin
if plotvalue <> plotvalue[1] then w = 0 else w = width;
Plot(plotvalue, "cross", color, default, w);
end;

Reply With Quote
 
(login for full post details)
  #3 (permalink)
 TraderDoc2 
Plainview
 
Experience: Intermediate
Platform: TradeStation
Broker: TradeStation
Trading: Futures
 
Posts: 18 since Mar 2012
Thanks: 1 given, 14 received


Nice code.

For some reason it originally looked like the last if statement had "//" in front of it.

I prefer to slightly alter the last 2 lines of code as follows:

 
Code
if plotvalue <> plotvalue[1] then w = 0 else w = width;

Plot1(plotvalue, "cross", color, default, w);

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #4 (permalink)
Kolnidrei
Lyon/France
 
 
Posts: 19 since Aug 2012
Thanks: 1 given, 13 received

sure, I added the 2 lines because this line is not mandatory ,
it only disables the ennoying vertical lines of connection between the different levels of the horizontal lines
but i forgot to add the drawings for the moving averages;
so one should add the following lines if one wishes to see them
 
Code
Plot2(value1, "MA", green, default, 2);
Plot3(value2, "EMA", red, default, 2);

Reply With Quote
 
(login for full post details)
  #5 (permalink)
Carlera
Colombia
 
 
Posts: 6 since Mar 2021
Thanks: 1 given, 1 received

Thanks traders for your support it was helpful for me.

Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Store value in variable when emas crossover easy language


Last Updated on December 24, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts