NexusFi: Find Your Edge


Home Menu

 





Easylanguage code problem, cross average


Discussion in EasyLanguage Programming

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




 
Search this Thread

Easylanguage code problem, cross average

  #1 (permalink)
ponex
brescia/italia
 
Posts: 6 since Aug 2017
Thanks Given: 1
Thanks Received: 0

Dears traders,

When sma60> sma90 and sma60> sma150 and sma90> sma150 we will take as maximum reference the maximum of the thirty candles before the cross.
If then this maximum will be broken upwards we will have long signal, otherwise short.

I have verified that it does not respect the minimum or maximum constraint of the 30 candles before the cross.
What's wrong with the formula ??

thank you.

luca


code:

Input: average(c), len(60), len1(90),len2(150);

condition1= len>len1 and len>len2 and len1>len2 ;
condition2=len<len1 and len<len2 and len1<len2;

condition3=H crosses over Highest(h,30);
condition4=L crosses under Lowest(l,30);

if condition1 and condition3 then buy next bar at market;
if condition1 and condition4 then sellshort next bar at market;

Attached Thumbnails
Click image for larger version

Name:	28.jpg
Views:	218
Size:	164.1 KB
ID:	240818  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
About a successful futures trader who didn´t know anyth …
Psychology and Money Management
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Quant vue
Trading Reviews and Vendors
Better Renko Gaps
The Elite Circle
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


ponex,

the code snippet you posted can't trigger any entries as condition1 can never become true. Based on that it's hard to tell you what is wrong, but you could use the print reserved word to find out what values your code used exactly that caused the entry.

Regards,

ABCTG


ponex View Post
Dears traders,

When sma60> sma90 and sma60> sma150 and sma90> sma150 we will take as maximum reference the maximum of the thirty candles before the cross.
If then this maximum will be broken upwards we will have long signal, otherwise short.

I have verified that it does not respect the minimum or maximum constraint of the 30 candles before the cross.
What's wrong with the formula ??

thank you.

luca


code:

Input: average(c), len(60), len1(90),len2(150);

condition1= len>len1 and len>len2 and len1>len2 ;
condition2=len<len1 and len<len2 and len1<len2;

condition3=H crosses over Highest(h,30);
condition4=L crosses under Lowest(l,30);

if condition1 and condition3 then buy next bar at market;
if condition1 and condition4 then sellshort next bar at market;


Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
ponex
brescia/italia
 
Posts: 6 since Aug 2017
Thanks Given: 1
Thanks Received: 0


ABCTG View Post
ponex,

the code snippet you posted can't trigger any entries as condition1 can never become true. Based on that it's hard to tell you what is wrong, but you could use the print reserved word to find out what values your code used exactly that caused the entry.

Regards,

ABCTG

hi ABCTG,
Thank you for the reply.

My problem is to code.
example buy:
When the averages cross up, the cross is the condition that if it is true we will have buy signal at the top when it is exceeds the previous 30 candles crossing.

regards

Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

ponex,

the first thing to add to your code would be the computation of the averages. After that you can check when your conditions are true i.e. on which bar and what values they use for the crossings using the print reserved word.
This will help you understand what it's going on within your code.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
ponex
brescia/italia
 
Posts: 6 since Aug 2017
Thanks Given: 1
Thanks Received: 0


ABCTG View Post
ponex,

the first thing to add to your code would be the computation of the averages. After that you can check when your conditions are true i.e. on which bar and what values they use for the crossings using the print reserved word.
This will help you understand what it's going on within your code.

Regards,

ABCTG

hi abctg


the code has improved,but it still does not respect the condiction:
if condition1 then entryl= highest(h,max)[1];
if condition2 then entrys=Lowest(l,min)[1];

code:

Input: price (close), len(60),len1(90),len2(150),max(30),min(30);

variables: var0(0), var1(0),var2(0),entryl(0),entrys(0);

var0=average (price,len);
var1=average (price,len1);
var2=average (price,len2);

condition1= var0>var1 and var0>var2 and var1>var2 ;
condition2=var0<var1 and var0<var2 and var1<var2;

if condition1 then entryl= highest(h,max)[1];
if condition2 then entrys=Lowest(l,min)[1];

if condition1 and h>entrys then buy next bar at market;
if condition2 and l< entrys then sellshort next bar at market;


regards

Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

ponex,

what are your results using the print reserved word? This a good way to help you finding out what is going on within your code.

Regards,

ABCTG

Follow me on Twitter Reply With Quote




Last Updated on September 3, 2017


© 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