NexusFi: Find Your Edge


Home Menu

 





Print values only when they met a condition


Discussion in EasyLanguage Programming

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




 
Search this Thread

Print values only when they met a condition

  #1 (permalink)
jlsegsan
Madrid
 
Posts: 10 since Feb 2018
Thanks Given: 0
Thanks Received: 0

Apologies in advance I am an absolute beginner

I coded a simple indicator to plot 3 moving averages
Then I add the condition of the first 2 crossing
I want to apply this indicator to the Radar where I have selected some values
My info extraction would be very simple at first:

- Future / Stock - Date - Value at which the 2 Moving Averages have crossed
but get data extraction only in the date in which I have a crossing, I don't need the Dates and Values without any Moving average crossing

I have managed to write the Plot part, even the Condition, but I don't know how to code the Print part

Your help would be really appreciated

My coding:

Inputs:

Price (Close),
Length1 (2),
Length2 (11),
Length3 (22),
ConfirmBars( 1 ) ;

Variables:

FileName (" "),
Counter( 0 );
{ Plot1 Averages on chart }

Plot1 ( AverageFC(Price , Length1), "Avg1");
Plot2 ( AverageFC(Price , Length2), "Avg2");
Plot3 ( AverageFC(Price , Length3), "Avg3");


if AverageFC(Price, Length1) > AverageFC( Price, Length2 ) then
Counter = Counter + 1;
if Counter = ConfirmBars then


Print ("Date -",ELDateToString(Date)," Avg1", Plot1:3.3, " Avg2", Plot2:3:4, " Avg3", Plot3:3:5) ;
If Currentbar = 1 then Print(File("C:\TestTemp.txt"),"Date - ",";"," Avg1 ",";"," Avg2 ",";"," Avg3 ") ;
Print(File("C:\TestTemp.txt"), ELDateToString(Date),";", Plot1:3.3, ";", Plot2:3:4, ";", Plot3:3:5) ;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
What broker to use for trading palladium futures
Commodities
MC PL editor upgrade
MultiCharts
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


jlsegsan,

check this thread: . @Big Mike this thread can probably be closed as duplicate.

Regards,

ABCTG

Follow me on Twitter Reply With Quote




Last Updated on February 2, 2018


© 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