NexusFi: Find Your Edge


Home Menu

 





Help with simple Code / Request


Discussion in EasyLanguage Programming

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




 
Search this Thread

Help with simple Code / Request

  #1 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
Posts: 16 since Sep 2020
Thanks Given: 22
Thanks Received: 10

Hello Guys!

I'm pretty new to Multicharts and Powerlanguage and i tried to create a simple indicator that should give me a visual signal when a condition is met.

Condition:
When Price (instead of price i use close of 1 minute Candle) is greater than last weeks high => color the 1 minute Candles.

 
Code
Input:
MA_Period(34);


Vars:
MA_Value(0),
TF_Price(2), 		//Price data of Subchart#2, shall simulate the price
TF_Daily(3),		//Price data of Subchart#2, TF D1
TF_Weekly(4),		//Price data of Subchart#2, TF W1
counter(0),
beginValue(1),
endValue(1440);




condition1 = High of data(TF_Price) > High of data(TF_Weekly) ;
condition2 = Close of data(TF_Price) < Low of data(TF_Weekly) ;



If condition1 Then PlotPaintBar(High, Low, Open, Close, "", Yellow)  of data(TF_Price) ;

If condition2 Then PlotPaintBar(High, Low, Open, Close, "", Magenta) of data(TF_Price);

The problem is, that the indicator paints the bars 1 Day too late as seen in the screenshots.
The price level where the arrow points to, is the last weeks high.

Seems that it recognizes or checks the condition too late...

I tried it now for hours, but i don't get any further... any ideas?

Thanks in advance!




https://prnt.sc/19s63rv

https://prnt.sc/19s68w8

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Spoo-nalysis ES e-mini futures S&P 500
14 thanks
  #2 (permalink)
 Anka Software   is a Vendor
 
Posts: 19 since Jan 2013
Thanks Given: 0
Thanks Received: 9

Hi,
If your requirement is to paint bar when the current price is above or below the current week high/low then the following changes should work

 
Code
condition1 = High of data(TF_Price) >= High of data(TF_Weekly) ;
condition2 = Close of data(TF_Price) <= Low of data(TF_Weekly) ;
Regards

Vivek

Reply With Quote
Thanked by:
  #3 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
Posts: 16 since Sep 2020
Thanks Given: 22
Thanks Received: 10



Anka Software View Post
Hi,
If your requirement is to paint bar when the current price is above or below the current week high/low then the following changes should work

 
Code
condition1 = High of data(TF_Price) >= High of data(TF_Weekly) ;
condition2 = Close of data(TF_Price) <= Low of data(TF_Weekly) ;
Regards

Vivek

Thanks for your answer!

I tried it, but it still doesn't recognize the break of last weeks High during the first day of the new week.

It's strange that it ignores the first day...

Started this thread Reply With Quote
  #4 (permalink)
 Anka Software   is a Vendor
 
Posts: 19 since Jan 2013
Thanks Given: 0
Thanks Received: 9

For last weeks high the code needs to be

 
Code
condition1 = High of data(TF_Price) >= High[1] of data(TF_Weekly) ;
condition2 = Close of data(TF_Price) <= Low[1] of data(TF_Weekly) ;

Reply With Quote
Thanked by:
  #5 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
Posts: 16 since Sep 2020
Thanks Given: 22
Thanks Received: 10


Anka Software View Post
For last weeks high the code needs to be

 
Code
condition1 = High of data(TF_Price) >= High[1] of data(TF_Weekly) ;
condition2 = Close of data(TF_Price) <= Low[1] of data(TF_Weekly) ;

Thanks, i tried that already, but this messes the chart more up than before:

With >= High[1] AND <= Low[1]
https://prnt.sc/19zovd4

With >= High of data AND <= Low of data
https://prnt.sc/19zp77v

Started this thread Reply With Quote
  #6 (permalink)
 Anka Software   is a Vendor
 
Posts: 19 since Jan 2013
Thanks Given: 0
Thanks Received: 9

Also what is the idea of using High of Data(TFPRice) in condition1 while close is used in condition 2?

Reply With Quote
  #7 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
Posts: 16 since Sep 2020
Thanks Given: 22
Thanks Received: 10


Anka Software View Post
Also what is the idea of using High of Data(TFPRice) in condition1 while close is used in condition 2?

Was just an error (replaced it with ("Low of Data(TFPrice)"), but didn't do any changes for the example i posted :/



Guys, i think i got it... but i don't know why...

 
Code
condition1 = Close >= High of data(TF_Weekly) ;
condition2 = Low <= Low of data(TF_Weekly) ;
The key was to repace "High of data(TFPrice)" with "High" or "Close".

But i thought "High of data(TFPrice) gives me the exact same value as Close...


Do you know my mistake in thinking?

Started this thread Reply With Quote




Last Updated on July 10, 2021


© 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