Arrays, functions. - futures io
futures io



Arrays, functions.


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,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
 

Arrays, functions.

(login for full post details)
  #1 (permalink)
soacm
Bucharest, Romania
 
 
Posts: 58 since Mar 2022
Thanks: 36 given, 13 received

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 futures io?
help with take profit several targets
TradeStation
How do I create Strategy with the Second Entry indicator
NinjaTrader
in depth understanding of last, bid, and ask volume in c …
NinjaTrader
Market on Close data within IB
Platforms and Indicators
Big Mo Indicator for NT8
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
RandomDude
Las Vegas, NV
 
 
Posts: 66 since Aug 2022
Thanks: 2 given, 18 received

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: 58 since Mar 2022
Thanks: 36 given, 13 received



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: 58 since Mar 2022
Thanks: 36 given, 13 received


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


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Arrays, functions.


Last Updated on August 25, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2023 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