Help with simple Code / Request - futures io
futures io



Help with simple Code / Request


Discussion in EasyLanguage Programming

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Help with simple Code / Request

(login for full post details)
  #1 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
 
Posts: 16 since Sep 2020
Thanks: 19 given, 10 received

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 futures io?
Script to add a moving average
ThinkOrSwim
Bars repainting
ThinkOrSwim
Can anyone create Risk Manager for MT5?
Traders Hideout
ORDER FLOW 30 - MISSING CELLTEXT - HELP
NinjaTrader
Slope Indicator with degrees
Emini and Emicro Index
 
Best Threads (Most Thanked)
in the last 7 days on futures io
How quickly do algos go bad?
76 thanks
Question about intraday margins
61 thanks
Avoiding Account Killing Freight Trains
24 thanks
How would you annotate this chart?
17 thanks
ZombiePack3 Indicators
14 thanks
 
(login for full post details)
  #2 (permalink)
 Anka Software 
Bangalore India
 
Experience: Intermediate
Platform: NinjaTrader, TradeStation
Trading: EUR/USD
 
Posts: 7 since Jan 2013
Thanks: 0 given, 4 received

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
The following user says Thank You to Anka Software for this post:
 
(login for full post details)
  #3 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
 
Posts: 16 since Sep 2020
Thanks: 19 given, 10 received



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
 
(login for full post details)
  #4 (permalink)
 Anka Software 
Bangalore India
 
Experience: Intermediate
Platform: NinjaTrader, TradeStation
Trading: EUR/USD
 
Posts: 7 since Jan 2013
Thanks: 0 given, 4 received

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
The following user says Thank You to Anka Software for this post:
 
(login for full post details)
  #5 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
 
Posts: 16 since Sep 2020
Thanks: 19 given, 10 received


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
 
(login for full post details)
  #6 (permalink)
 Anka Software 
Bangalore India
 
Experience: Intermediate
Platform: NinjaTrader, TradeStation
Trading: EUR/USD
 
Posts: 7 since Jan 2013
Thanks: 0 given, 4 received

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

Reply With Quote
 
(login for full post details)
  #7 (permalink)
 InterstellarBeing 
Linz, Upper Austria
 
Experience: Intermediate
Platform: NT8
Trading: Currency Futures
 
Posts: 16 since Sep 2020
Thanks: 19 given, 10 received


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


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Help with simple Code / Request


Last Updated on July 10, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing

A Transparent Glimpse Into a Prop Traders Life w/Chris Gray @ Earn2Trade

Elite only
 

Our 12-year anniversary w/ $$,$$$ prizes (check soon)

August
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
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.
no new posts