NexusFi: Find Your Edge


Home Menu

 





Help with indicator coding


Discussion in EasyLanguage Programming

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




 
Search this Thread

Help with indicator coding

  #1 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0

Hello! Help with the coding indicator.
It is necessary that if the tick exceeds the tick and this condition is also fulfilled on the next bar, then the values of these ticks should be summed up before the appearance of the down tix over the apix. And output this summarized histogram at the bottom of the chart.
Here is the code I wrote. But apparently there are errors. Please help me fix it.

 
Code
Vars:
UTSum( 0 ),
DTSum( 0 );

array :
UT[](0),
DT[](0);

UT [value1] = UpTicks(value1);
DT [value1] = DownTicks(value1);

if BarType <= 1 or BarType >= 5 then

If (UpTicks > DownTicks) then
begin
UTSum = array_sum(UT,0,value1-1);

Plot1( UTSum, "VolUp",Blue ) ;
end;


If (UpTicks < DownTicks) then

begin
DTSum = array_sum (DT,0,value1-1);

Plot2( DTSum, "VolDn",red ) ;
end;
Plot3( 0, "Zero");

Attached Thumbnails
Click image for larger version

Name:	Screenshot_8.png
Views:	182
Size:	18.0 KB
ID:	258975  
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
61 thanks
NexusFi site changelog and issues/problem reporting
46 thanks
Battlestations: Show us your trading desks!
38 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
25 thanks

  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


Fobos,

can you elaborate a bit more what exactly you are trying to compute and to measure as this might help in pointing you in the right direction.

Instead of using arrays you might just require two variables that you reset when the opposite condition is met and otherwise add the the value of Up- or DownTicks.

Besides that your "if BarType <= 1 or BarType >= 5 then" statement only affects part of your code, is this intended?

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0


ABCTG View Post
Fobos,

can you elaborate a bit more what exactly you are trying to compute and to measure as this might help in pointing you in the right direction.

Instead of using arrays you might just require two variables that you reset when the opposite condition is met and otherwise add the the value of Up- or DownTicks.

Besides that your "if BarType <= 1 or BarType >= 5 then" statement only affects part of your code, is this intended?

Regards,

ABCTG

The idea is this. If up ticks in a bar are more than down ticks and in subsequent bars the same condition, then sum up ticks. As soon as subsequent bars exceed down ticks more up ticks, then sum the down ticks. And the amount of up ticks and down ticks display on the historgam below.

Reply With Quote
  #5 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0

If not through an array, then how to do it? Help with the code.

Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

Fobos,

based on your code you could accomplish the same with two variables. When your condition "If (UpTicks > DownTicks) " is met you add the value of UpTicks to a variable and vice versa using another variable for your second condition, but using DownTicks.
This way these two variables will hold the summation of UpTicks and DownTicks for the bars where your conditions are valid.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #7 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0


ABCTG View Post
Fobos,

based on your code you could accomplish the same with two variables. When your condition "If (UpTicks > DownTicks) " is met you add the value of UpTicks to a variable and vice versa using another variable for your second condition, but using DownTicks.
This way these two variables will hold the summation of UpTicks and DownTicks for the bars where your conditions are valid.

Regards,

ABCTG

 
Code
Vars:
UTSum( 0 ),
DTSum( 0 );



if BarType <= 1 or BarType >= 5 then

If (UpTicks > DownTicks) then
begin
UTSum = UTSum + UpTicks;

Plot1( UTSum, "VolUp",Blue ) ;
end;

if BarType <= 1 or BarType >= 5 then

If (UpTicks < DownTicks) then

begin
DTSum = DTSum + DownTicks ;

Plot2( DTSum, "VolDn",red ) ;
end;
Plot3( 0, "Zero");
Changed the code. But now he summarizes the progression.How to reset the summation after the opposite condition?

Attached Thumbnails
Click image for larger version

Name:	Screenshot_8.png
Views:	187
Size:	73.8 KB
ID:	259013  
Reply With Quote
  #8 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

Fobos,

you could for example set the variable to 0 when the opposite condition is met.

Regards,

ABCTG


Fobos
How to reset the summation after the opposite condition?


Follow me on Twitter Reply With Quote
  #9 (permalink)
Fobos
Ukraina
 
Posts: 18 since Aug 2010
Thanks Given: 5
Thanks Received: 0


ABCTG View Post
Fobos,

you could for example set the variable to 0 when the opposite condition is met.

Regards,

ABCTG

Thank you so much! Everything worked out. Tell me, what else is the opportunity to do this? For general development is interesting.

Reply With Quote
  #10 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


Fobos ,

you are welcome.

I am afraid I don't understand what you mean with "what else is the opportunity to do this?", maybe you can elaborate a bit more what you mean?

Regards,

ABCTG


Fobos View Post
Thank you so much! Everything worked out. Tell me, what else is the opportunity to do this? For general development is interesting.


Follow me on Twitter Reply With Quote





Last Updated on November 16, 2018


© 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