Need help with PKPriceAlert2 indicator - NinjaTrader Programming | futures io social day trading
futures io futures trading


Need help with PKPriceAlert2 indicator
Updated: Views / Replies:2,761 / 21
Created: by Todd Attachments:5

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 5  
 
Thread Tools Search this Thread
 

Need help with PKPriceAlert2 indicator

  #11 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

hey Todd - we come near the target !

great to hear you mastered the errors now - it was all because of wrong or missing brackets - well - that happens easiely.

now you miss still the sound alert - here is the solution -maybe i wasnt clear enaugh here :

down in the code in lines from 90 to 120

alertOBStoch in the code must be WITHOUT quotes ( " ... " ) !

like this :

 
Code
                            
"  Price=" PriceAlert ,  alertOBStoch 60Color.Blue,Color.White); 



and then you insert you wished wav-file in the parameters.
then that work !


..

max-td
Attached Thumbnails
Need help with PKPriceAlert2 indicator-sound-2010-02-18_182239.png  
Reply With Quote
The following user says Thank You to max-td for this post:
 
  #12 (permalink)
Elite Member
Alpharetta, GA
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: Mirus / Zenfire
Favorite Futures: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

Hey Max,

That worked!!

Almost to the finish line...

Two final things...

#1
Can you tell me what lines of code I need to change to get the fields on indicator screen to not say "AlertOBStoch" and "AlertOSStoch". I'm not talking about the input field where I enter the wav file name, I'm talking about the other field in the left column.

I tried replacing AlertOBStoch and AlertOSStoch in the variables section, the code section and the properties section. I got the error shown in the attached link. I'm sure I'm missing something very simple, just don't know what it is...
http://screencast.com/t/YzgwNGY0Yzg
http://screencast.com/t/NzUxYWQ3NzIt
http://screencast.com/t/NDM2NGIyNmY

Edit added - 5:45pm 2-18-10
Even though it says the error is in lines 138 and 146, I decided to take screencasts of the other 2 sections of code also. I thought I followed what you had done in your Stoch-D indicator but I've obviously got something slightly (or majorly) wrong.




#2
For some reason, in order to have this indicator work for cases where price is piercing up thru the horizontal line AND cases where price is piercing down thru the horizontal line, you've got to select this indicator twice from the indicator list - one for uptrend and one for downtrend. That seems weird considering that the code seems to have places for "price breaking up thru line" and "price breaking down thru line".

Can you read the code well enough to understand why you would need two occurences of the indicator? If you understand it and it must be that way, can you explain it? If you understand it and can change the code so it won't need two occurences of the indicator, can you do that or tell me how to do that?

I can live with the indicator like it is (especially after I get issue #1 above resolved), however, it seems stupid to need two occurences of the indicator - 1 for uptrend and 1 for downtrend. But what do I know...

Thanks again for the help.

Todd


Last edited by Todd; February 18th, 2010 at 06:43 PM.
Reply With Quote
The following user says Thank You to Todd for this post:
 
  #13 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received


hi again,
to #1 - i think all you did is OK but the error is in lines 138 and 146 - right.

compare those lines again exactly with my example and have a look to what is written with a first big letter + what is written with a first small one - thats the key here i think.

all these micro-details - i also ran into these errors as i started to try my first codes 1,5 years ago or so -- i started with knowing nothing at all about coding - never learned this in school or elsewhere ... didnt know that there are such grazy traps - lol

max-td
Reply With Quote
 
  #14 (permalink)
Elite Member
Alpharetta, GA
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: Mirus / Zenfire
Favorite Futures: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

Hey Max,

You were right... the lower case and capital letters were the difference. I missed that. THANKS!

Do you have any thoughts on issue #2 that I raised in my last post?

Todd

Reply With Quote
 
  #15 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

great to hear !

yes i have some thoughts -- i post later -- need lunch now

max-td
Reply With Quote
 
  #16 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received

here you see whats the logic for alert to the upside :

 
Code
                            

                    
if ( (this.uptrend == true) &&
                         (
Close[0] > Close[1])   && 
                         (
Close[0] > PriceAlert) &&
                         (
Close[1] < PriceAlert)    ) 
Close[0] means the Close of very last candle
Close[1] means the Close of the candle before that.
PriceAlert means the value you horizontal line sits on

so the indie works with the closing-price of the bars.
if your candel peaks the Alert-line with its High but then closes below again - you dont get an alert!

thats the rules in the code here.
the next step is up to you again

BTW - did you try it with calconbarclose set to false ?

...

max-td
Attached Thumbnails
Need help with PKPriceAlert2 indicator-pk-alert.png  
Reply With Quote
 
  #17 (permalink)
Elite Member
Alpharetta, GA
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: Mirus / Zenfire
Favorite Futures: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

Max,

Thanks..

2 Issues...
1. If I wanted to change the code to have it give an alert if the horizontal line price is touched instead of just a close beyond it, how would I do that?


2. Do you know if it's possible to change the code so I don't need to put 2 of these indicators in my chart instead of just 1? This isn't a big hassle, it's just more of the principle... it seems like bad code to need to put 2 of the same indicator on the chart to make it work.

To make it work for price piercing up thru the line or price piercing down thru the line, I'm guessing that you would need to add some "OR" statements. But I don't know if that is easy to do in NT.

I've posted the current code at the bottom of this code if that is helpful to anyone. It's a work in progress but here are the improvements so far...
1. It works on instruments with 2 digits after the decimal (like ES) and also works on charts with 4 digits like 6a, 6e, 6b, etc.

2. Audio Input File Fields have been added to the indicator input screen so you don't have to be stuck with one alert or change the alert in the code.

Todd

Attached Files
Register to download File Type: zip PKPriceAlert2.zip (2.4 KB, 31 views)
Reply With Quote
 
  #18 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received


Todd View Post
1. If I wanted to change the code to have it give an alert if the horizontal line price is touched instead of just a close beyond it, how would I do that?

hmm Todd - i realy try to help you to understand what you do in the code.

if we now have the Close of the Bar as a trigger-value - and it doesnt trigger when it only peaks the line and closes below it again - what do you think may help here ? its no big coding-trick - its just an easy logical thing.

about combining up+down alerts - it may give a lot of signals+noise if price oscilates around the line - maybe thats why its seperated now - its made as a clear one-time-signal when trigger happens.

you can try it with commenting out the "up or down- condition-check" like this and test how it behaves :

 
Code
                            
//   (this.uptrend == false) &&


//  (this.uptrend == true) && 

..

max-td
Reply With Quote
 
  #19 (permalink)
Elite Member
Alpharetta, GA
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: Mirus / Zenfire
Favorite Futures: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

Max,

A minute ago I wrote a long reply but somehow when I hit submit, there was an error that erased it.

Anyway, I understand the "close of bar" logic. I just don't know the NT language so I don't know how to say "touch of price" with regard to the price bar. However, "close of bar" may be better because it may prevent from getting a bunch of alerts at one time as price moves back and forth across the line within 1 bar.

Regarding the uptrend/downtrend thing... I'll comment those lines out and see what happens. I'm guessing that the code will just stop working when I comment out those lines but we shall see.

Any idea why this indicator would only work in real time and not when I do market replay?

Todd


Last edited by Todd; February 21st, 2010 at 04:28 PM.
Reply With Quote
 
  #20 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: FGBL 6E B4
 
max-td's Avatar
 
Posts: 1,754 since Jun 2009
Thanks: 2,309 given, 917 received


OK - so here my thoughts :

in general every Bar has 4 clear defined "datas" : Open / Close / High / Low

a peak of this line without a Close above means, that the price WAS above the line one time.
If the price was above ths line, i have the HIGH of this Bar above the line !
so i use the High instead the Close - thats my logical "trick" here.

why its not working on marketreplay -- dont know.

try the commenting-out - it should work - try if its making sense for your need.

cu later

..

max-td
Reply With Quote

Reply



futures io > > > > > Need help with PKPriceAlert2 indicator

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
PkPriceAlert2 for NT7 - need help Todd NinjaTrader Programming 43 November 22nd, 2014 12:53 PM


All times are GMT -4. The time now is 05:04 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, 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
Page generated 2017-12-16 in 0.13 seconds with 20 queries on phoenix via your IP 54.163.210.170