NexusFi: Find Your Edge


Home Menu

 





Spot the code error in afl please.


Discussion in Platforms and Indicators

Updated
      Top Posters
    1. looks_one prouser with 7 posts (4 thanks)
    2. looks_two milkysahai001 with 6 posts (0 thanks)
    3. looks_3 mmaker with 4 posts (1 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 4,226 views
    2. thumb_up 5 thanks given
    3. group 3 followers
    1. forum 17 posts
    2. attach_file 0 attachments




 
Search this Thread

Spot the code error in afl please.

  #1 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3

I am trying to code signals based on my own indicator, but the indicators are overlapping throughout on the chart. The formula for them is totally different but the values are coming same. Also there is no problem in compiling the afl. Can somebody point out the error in my code?

Vclose = 0;
Vclose = (Om+Hm+Lm+Cm)/4;
Vopen = 0;
Value1 = IIf (Ref (vOpen, -1) > 0, Ref(vOpen, -1), vClose);
Vopen = ((value1) + smooth * ( vClose - value1));

the values of vClose and vOpen should not come the same.
Please consider that I am newbie in afl coding.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
42 thanks
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #2 (permalink)
 prouser 
Zurich/Switzerland
 
Posts: 79 since Oct 2014

First of all your code is incomplete.
Secondly do you realize that you have assigned zero to Vopen and Vclose?

Reply With Quote
  #3 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3


Prouser,

Yes I know the code is incomplete. it is the part in which the error is.
I assigned zero to vOpen and vClose as it was asking to initialize them.

Reply With Quote
  #4 (permalink)
 
mmaker's Avatar
 mmaker 
Toronto Canada
 
Experience: Intermediate
Platform: ninjatrader
Trading: es
Frequency: Several times daily
Duration: Minutes
Posts: 400 since Feb 2011
Thanks Given: 1,178
Thanks Received: 508


milkysahai001 View Post
I am trying to code signals based on my own indicator, but the indicators are overlapping throughout on the chart. The formula for them is totally different but the values are coming same. Also there is no problem in compiling the afl. Can somebody point out the error in my code?

Vclose = 0;
Vclose = (Om+Hm+Lm+Cm)/4;
Vopen = 0;
Value1 = IIf (Ref (vOpen, -1) > 0, Ref(vOpen, -1), vClose);
Vopen = ((value1) + smooth * ( vClose - value1));

the values of vClose and vOpen should not come the same.
Please consider that I am newbie in afl coding.

i dont have a clue what afl is but i can tell you what is happening with your logic....

the then part of your if statement is never executed.
Only the else branch is executed.
Hence Value 1 always equals the close.
Therefore vClose - value1 equals zero in the last line.....
Therefore smooth * ( vClose - value1)); goes to zero and you are left with.....
Vopen = ((value1)
and since value 1 equals the close....denoted as vClose....
Vopen equals vClose

so what the heck is afl?


Look at your raw data going into this logic and walk thru your code with the raw data.

Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3


mmaker View Post
i dont have a clue what afl is but i can tell you what is happening with your logic....

the then part of your if statement is never executed.
Only the else branch is executed.
Hence Value 1 always equals the close.
Therefore vClose - value1 equals zero in the last line.....
Therefore smooth * ( vClose - value1)); goes to zero and you are left with.....
Vopen = ((value1)
and since value 1 equals the close....denoted as vClose....
Vopen equals vClose

so what the heck is afl?


Look at your raw data going into this logic and walk thru your code with the raw data.

mmaker,

afl is amibroker formula language, used for coding algorithm which can run in amibroker trading platform.
thanks for your input. i will trying doing what you suggested.

Reply With Quote
  #6 (permalink)
 prouser 
Zurich/Switzerland
 
Posts: 79 since Oct 2014


milkysahai001 View Post
Prouser,

Yes I know the code is incomplete. it is the part in which the error is.
I assigned zero to vOpen and vClose as it was asking to initialize them.

Are you trying to translate from a different language?
Are you trying to create Heikin Ashi?
You should provide more info on what you are trying to achieve because right now your code doesn't make much sense.

Reply With Quote
  #7 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3


prouser View Post
Are you trying to translate from a different language?
Are you trying to create Heikin Ashi?
You should provide more info on what you are trying to achieve because right now your code doesn't make much sense.


Prouser,

Yes I am trying to create Heikin Ashi. for that i need to get the modified prices for which I am writing the mentioned afl. I coded it in easy language for multicharts but not able to go on with afl because of this glitch.

Reply With Quote
  #8 (permalink)
 prouser 
Zurich/Switzerland
 
Posts: 79 since Oct 2014


mmaker View Post
what the heck is afl
...
i dont have a clue what afl is
...
so what the heck is afl?

You have 300 posts and are member since 2011 and you are still unable to look at the link at the top which is clearly showing to you that you are in AmiBroker discussion area?



Are you trolling?

Anyway with upper easy simple platform info are you still unable to use search engines? Really?
https://lmgtfy.app/?q=AmiBroker+AFL

Reply With Quote
  #9 (permalink)
 prouser 
Zurich/Switzerland
 
Posts: 79 since Oct 2014


milkysahai001 View Post
Prouser,

Yes I am trying to create Heikin Ashi. for that i need to get the modified prices for which I am writing the mentioned afl. I coded it in easy language for multicharts but not able to go on with afl because of this glitch.

There are Heikin Ashi AFLs on the Internet.

Reply With Quote
  #10 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3



prouser View Post
There are Heikin Ashi AFLs on the Internet.


Prouser,

I am looking for them. Thanks.

Reply With Quote




Last Updated on December 7, 2016


© 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