NexusFi: Find Your Edge


Home Menu

 





Filters combo


Discussion in EasyLanguage Programming

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




 
Search this Thread

Filters combo

  #1 (permalink)
maxk
Taipei, Taiwan
 
Posts: 9 since Jun 2023
Thanks Given: 2
Thanks Received: 1

Hi there,
I’m trying to code a filter combo which will collect useful filter or filters for certain signals from the list. Does anyone know how to finish this?

Code example: (Fx from 0 to 1)
Inputs: Fx1(0), Fx2(0), Fx3(0), Fx4(0); {there could be more Fx}
If Fx1 = 1 then begin
Value1 > Value1[1]; {Trend}
end;
If Fx2 = 1 then begin
Value1 < Value1[1]; {C.Trend}
end;
If Fx3 = 1 then begin
Value3 < AbsValue(Value1 – Value2); {Bios}
end;
If Fx4 = 1 then begin
Value4 < AbsValue(C-Value1); {Bios}
end;
If MP <= 0 and Fx1 and Fx2 and Fx3 and Fx4 then buy next bar at Value11 stop;
If MP >= 0 and Fx1 and Fx2 and Fx3 and Fx4 then buy next bar at Value22 stop;

Thanks for your time.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
What broker to use for trading palladium futures
Commodities
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
24 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
ApexTraderFunding.com experience and review
16 thanks
GFIs1 1 DAX trade per day journal
12 thanks
EG Indicators
11 thanks
  #2 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,388
Thanks Received: 10,208

What are trying to actually do?

This code does nothing other than check to see if Value1>Value1[1] it doesn't actually assign the result to anything
 
Code
If Fx1 = 1 then begin
Value1 > Value1[1]; {Trend}
end;
If your trying to check whether condition1 is true and then use it later then you need to use a variable to hold the result
 
Code
Inputs: Fx1(0);
Var: Fx1_Result(FALSE);

If Fx1 = 1 then begin
 Fx1_Result = Value1 > Value1[1];
end;

If (MP <= 0 and Fx1_Result) then buy next bar at XYZ stop;
Note that since Fx1_Result is set to FALSE in the variable declaration it can only be TRUE if both Fx1 = 1 and the condition is met.

Reply With Quote
Thanked by:
  #3 (permalink)
maxk
Taipei, Taiwan
 
Posts: 9 since Jun 2023
Thanks Given: 2
Thanks Received: 1


Thanks for your reply. Sorry I'm new here and try to build a filter combo or function so I can use it for further develope.

Following your codes I modify mine as below and the editor show me: "Invalid type operation":
Inputs: Trend(200), ShortT(70),
BiosL(60), BiosS(60),
Fx1(1), Fx2(1), Fx3(1), Fx4(1), Fx5(1), Fx6(1);

Vars: Fx1_Result(FALSE), Fx2_Result(FALSE), Fx3_Result(FALSE), Fx4_Result(FALSE),
Fx5_Result(FALSE), Fx6_Result(FALSE), Fx7_Result(FALSE), Fx8_Result(FALSE);

Value55 = XAverage(C, ShortT);
Value66 = XAverage(C, Trend) ;
Value77 = AbsValue(C - Value55);

Condition1 = C cross over Value66;
Condition2 = C cross under Value66;

If Fx1 = 1 then begin
Fx1_Result = Value55 > Value55[1];
end;
If Fx2 = 1 then begin
Fx2_Result = Value55 < Value55[1];
end;
If Fx3 = 1 then begin
Fx3_Result = Value77 < BiosL;
end;
If Fx4 = 1 then begin
Fx4_Result = Value77 < BiosL;
end;
If Fx5 = 1 then begin
Fx5_Result = Value77 < Value77[1];
end;
If Fx6 = 1 then begin
Fx6_Result = Value77 > Value77[1];
end;

If MP <= 0 and Condition1 and Fx1 and Fx2 and Fx3 and Fx4 and Fx5 and Fx6 then buy next bar market;
If MP >= 0 and Condition2 and Fx1 and Fx2 and Fx3 and Fx4 and Fx5 and Fx6 then buy next bar market;



SMCJB View Post
What are trying to actually do?

This code does nothing other than check to see if Value1>Value1[1] it doesn't actually assign the result to anything
 
Code
If Fx1 = 1 then begin
Value1 > Value1[1]; {Trend}
end;
If your trying to check whether condition1 is true and then use it later then you need to use a variable to hold the result
 
Code
Inputs: Fx1(0);
Var: Fx1_Result(FALSE);

If Fx1 = 1 then begin
 Fx1_Result = Value1 > Value1[1];
end;

If (MP <= 0 and Fx1_Result) then buy next bar at XYZ stop;
Note that since Fx1_Result is set to FALSE in the variable declaration it can only be TRUE if both Fx1 = 1 and the condition is met.


Reply With Quote
  #4 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,388
Thanks Received: 10,208

Sorry been busy. May try and test it tonight but just looking at the code.

 
Code
Condition1 = C cross over Value66;

not sure if you need cross or crosses
 
Code
Condition1 = C crosses over Value66;

Also just a note. With your 'If' statements, if there's only one statement after it you don't need the loop. So
 
Code
If Fx1 = 1 then begin
Fx1_Result = Value55 > Value55[1];
end;

can be just
 
Code
If Fx1 = 1 then Fx1_Result = Value55 > Value55[1];

Reply With Quote
  #5 (permalink)
maxk
Taipei, Taiwan
 
Posts: 9 since Jun 2023
Thanks Given: 2
Thanks Received: 1

No problem, sorry for any interruption.

To response:
1) crosses;
2) still got the message "Invalid type operation"



SMCJB View Post
Sorry been busy. May try and test it tonight but just looking at the code.

 
Code
Condition1 = C cross over Value66;

not sure if you need cross or crosses
 
Code
Condition1 = C crosses over Value66;

Also just a note. With your 'If' statements, if there's only one statement after it you don't need the loop. So
 
Code
If Fx1 = 1 then begin
Fx1_Result = Value55 > Value55[1];
end;

can be just
 
Code
If Fx1 = 1 then Fx1_Result = Value55 > Value55[1];


Reply With Quote
  #6 (permalink)
 
ShadowFox's Avatar
 ShadowFox 
CO/USA
 
Experience: Intermediate
Platform: TradeStation, Multicharts
Trading: Stocks, Futures
Posts: 129 since Jun 2020
Thanks Given: 70
Thanks Received: 157

I suspect it's your buy conditions. You used your filter selection inputs which were numbers instead of your RESULT variables which are bools. The invalid type is referring to the condition needing to be a bool.

Sent using the NexusFi mobile app

Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 
ShadowFox's Avatar
 ShadowFox 
CO/USA
 
Experience: Intermediate
Platform: TradeStation, Multicharts
Trading: Stocks, Futures
Posts: 129 since Jun 2020
Thanks Given: 70
Thanks Received: 157

Forgot to mention that you should set your results to be true if your input condition is zero (assuming you are flipping a zero and one). This will allow your buy conditions to still be met when the filter is off.

Sent using the NexusFi mobile app

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
maxk
Taipei, Taiwan
 
Posts: 9 since Jun 2023
Thanks Given: 2
Thanks Received: 1

Thanks for your respone but I don't really understand, could you please give an example?


ShadowFox View Post
Forgot to mention that you should set your results to be true if your input condition is zero (assuming you are flipping a zero and one). This will allow your buy conditions to still be met when the filter is off.

Sent using the NexusFi mobile app


Reply With Quote
  #9 (permalink)
 
SMCJB's Avatar
 SMCJB 
Houston TX
Legendary Market Wizard
 
Experience: Advanced
Platform: TT and Stellar
Broker: Advantage Futures
Trading: Primarily Energy but also a little Equities, Fixed Income, Metals and Crypto.
Frequency: Many times daily
Duration: Never
Posts: 5,049 since Dec 2013
Thanks Given: 4,388
Thanks Received: 10,208


maxk View Post
Thanks for your respone but I don't really understand, could you please give an example?


ShadowFox View Post
I suspect it's your buy conditions. You used your filter selection inputs which were numbers instead of your RESULT variables which are bools. The invalid type is referring to the condition needing to be a bool.

Believe he's saying

If MP <= 0 and Condition1 and Fx1 and Fx2 and Fx3 ... and Fx6 then buy next bar market;

Should be

If MP <= 0 and Condition1 and Fx1_Result and Fx2_Result and Fx3_Result ... and Fx6_Result then buy next bar market;


ShadowFox View Post
Forgot to mention that you should set your results to be true if your input condition is zero (assuming you are flipping a zero and one). This will allow your buy conditions to still be met when the filter is off.

And here if you want it to be true when input is zero then

Vars: Fx1_Result(FALSE), Fx2_Result(FALSE), Fx3_Result(FALSE), Fx4_Result(FALSE)...

becomes

Vars: Fx1_Result(TRUE), Fx2_Result(TRUE), Fx3_Result(TRUE)....

Reply With Quote
  #10 (permalink)
maxk
Taipei, Taiwan
 
Posts: 9 since Jun 2023
Thanks Given: 2
Thanks Received: 1


Thank you both very much, it work and I finish what I want.

Thank you.


ShadowFox
Forgot to mention that you should set your results to be true if your input condition is zero (assuming you are flipping a zero and one). This will allow your buy conditions to still be met when the filter is off.





SMCJB View Post
Believe he's saying

If MP <= 0 and Condition1 and Fx1 and Fx2 and Fx3 ... and Fx6 then buy next bar market;

Should be

If MP <= 0 and Condition1 and Fx1_Result and Fx2_Result and Fx3_Result ... and Fx6_Result then buy next bar market;


And here if you want it to be true when input is zero then

Vars: Fx1_Result(FALSE), Fx2_Result(FALSE), Fx3_Result(FALSE), Fx4_Result(FALSE)...

becomes

Vars: Fx1_Result(TRUE), Fx2_Result(TRUE), Fx3_Result(TRUE)....


Reply With Quote
Thanked by:




Last Updated on August 23, 2023


© 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