NexusFi: Find Your Edge


Home Menu

 





Arrays, functions.


Discussion in EasyLanguage Programming

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




 
Search this Thread

Arrays, functions.

(login for full post details)
  #1 (permalink)
soacm
Bucharest, Romania
 
Posts: 71 since Mar 2022
Thanks Given: 38
Thanks Received: 22

Hi, I would like to create a function (MyPTN) that is formed by different descriptions of patterns/market behaviors. These patterns should be declared as arrays (correct me if I'm wrong) and then define the function MyPTN that retrieves these patters/market behaviors.

Code I came up with:
 
Code
Array: PTN[10](0),       // Indicating 11 arrays from 0 to 10 (?) 
       numberPTN[10](0);  
 
PTN[1] = Close > Close[1];  
PTN[2] = Close < Close[1];  
{list can go on} 
 
MyPTN = PTN[numberPTN]; // Function
This is just an idea since I never worked with arrays; at the moment I am getting an error indicating the ">" sign (numerical expression expected here).
The function will be used in a strategy, it should allow me to analyze the different results of the listed PTNs.
Any suggestion is appreciated.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Request for MACD with option to use different MAs for fa …
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
30 thanks
GFIs1 1 DAX trade per day journal
28 thanks
Supertradersams Thread Journal on NQ/MNQ
25 thanks
Deaddogs Stock Trading
22 thanks
Leaving CFD trading and learning futures
11 thanks

(login for full post details)
  #2 (permalink)
RandomDude
Las Vegas, NV
 
Posts: 66 since Aug 2022
Thanks Given: 2
Thanks Received: 18

Note sure what system you are using and not a real programmer, but thinking issue may be it's not seeing the boolean expression as a value, so something like:

 
Code
PTN[1] = if Close > Close[1] then 1 else 0;
I really don't know though.

Reply With Quote
The following user says Thank You to RandomDude for this post:
(login for full post details)
  #3 (permalink)
soacm
Bucharest, Romania
 
Posts: 71 since Mar 2022
Thanks Given: 38
Thanks Received: 22



RandomDude View Post
Note sure what system you are using and not a real programmer, but thinking issue may be it's not seeing the boolean expression as a value, so something like:

 
Code
PTN[1] = if Close > Close[1] then 1 else 0;
I really don't know though.

By reading the EasyLanguage PDF, I think "Function Array parameter declaration" (page 109) is the solution. But again, I never used them, and trying to figure it out, any advice is welcome.

Reply With Quote
(login for full post details)
  #4 (permalink)
soacm
Bucharest, Romania
 
Posts: 71 since Mar 2022
Thanks Given: 38
Thanks Received: 22


soacm View Post
Hi, I would like to create a function (MyPTN) that is formed by different descriptions of patterns/market behaviors. These patterns should be declared as arrays (correct me if I'm wrong) and then define the function MyPTN that retrieves these patters/market behaviors.

Code I came up with:
 
Code
Array: PTN[10](0),       // Indicating 11 arrays from 0 to 10 (?) 
       numberPTN[10](0);  
 
PTN[1] = Close > Close[1];  
PTN[2] = Close < Close[1];  
{list can go on} 
 
MyPTN = PTN[numberPTN]; // Function
This is just an idea since I never worked with arrays; at the moment I am getting an error indicating the ">" sign (numerical expression expected here).
The function will be used in a strategy, it should allow me to analyze the different results of the listed PTNs.
Any suggestion is appreciated.

Current possible solution but still get an error:
 
Code
// Boolean function MyPTN  
inputs:  
	PatternNumber(numericsimple); 
 
arrays: 
	Patterns[10](false); 
 
// List of patterns  
Patterns[1] = Close > Close[1];  
Patterns[2] = Close < Close[1];  
{rest of the list}  
  
MyPTN = Patterns[PatternNumber];
The error is in the function MyPTN = Patterns[PatternNumber] "Numerical expression expected here" ("Patterns" is highlighted).

Reply With Quote





Last Updated on August 25, 2022


© 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