| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Help Coding with iCustom(PinBar) https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5390 |
Page 1 of 2 |
| Author: | fx800 [ Thu Feb 08, 2018 1:50 pm ] |
| Post subject: | Help Coding with iCustom(PinBar) |
Hi I am attempting to code an ea using a Pin Bar indicator using Steve's shell ea. The code is shown below. I would be very grateful if one of our expert coders could have a look and see if it is correct. Thanks in advance. peter Code: Select all |
|
| Author: | SteveHopwood [ Thu Feb 08, 2018 5:54 pm ] |
| Post subject: | Help Coding with iCustom(PinBar) |
Looks good to me. The only thing is to check that the indi returns EMPTY_VALUE which is a mahossive integer and not a double, which will be 0. To test, change the shift to a value you know did not generate a pinbar signal then, after val = iCustom(Symbol(), TradingTimeFrame, "PinBar", 0, SomeShift); add this: Alert(val); This will show whether the indi is returning 0 or EMPTY_VALUE when there is no signal. I do this with every CCA I use when coding EA's. Brilliant to see you getting your hands dirty. |
|
| Author: | fx800 [ Thu Feb 08, 2018 10:41 pm ] |
| Post subject: | Help Coding with iCustom(PinBar) |
Thank you very much Steve. Will try the test as you have suggest. peter |
|
| Author: | fx800 [ Fri Feb 09, 2018 7:25 am ] |
| Post subject: | Help Coding with iCustom(PinBar) |
Good morning. I carried out the test as Steve suggested and the test returned the number 2147483647 which is the default value for EMPTY_VALUE. So I guess the code snippet for the indi should work ok. I have attached the ea to M15 charts and wait to see if it works. peter |
|
| Author: | SteveHopwood [ Fri Feb 09, 2018 12:11 pm ] |
| Post subject: | Help Coding with iCustom(PinBar) |
Please let us know Peter, for a round of applause. |
|
| Author: | fx800 [ Fri Feb 09, 2018 1:28 pm ] |
| Post subject: | Help Coding with iCustom(PinBar) |
Still patiently waiting for a trade. The ea is an exercise in attempting to code an ea to test a theory. I have added SHI CHANNEL and SUPERSLOPE, a copy and paste job using code snippets from Steve's ea's. It is attached below in case someone would like to take a peek at it. peter p.s. in case you are wondering, SHS stands for SteveHopwood Shell ea. |
|
| Author: | fx800 [ Sun Feb 11, 2018 6:30 am ] |
| Post subject: | Help Coding with iCustom(PinBar) |
The previous code did not work. Will the following one work ? Code: Select all |
|
| Author: | SteveHopwood [ Sun Feb 11, 2018 11:17 am ] |
| Post subject: | Help Coding with iCustom(PinBar) |
I have time on my hands this week. Upload the indi and I will see what is wrong with your code. |
|
| Author: | fx800 [ Sun Feb 11, 2018 11:59 am ] |
| Post subject: | Help Coding with iCustom(PinBar) |
Thank you very much Steve. peter |
|
| Author: | SteveHopwood [ Sun Feb 11, 2018 1:33 pm ] |
| Post subject: | Help Coding with iCustom(PinBar) |
I loaded your code into a script and set the iCustom shift to a bar that has an arrow and it returned the price correctly, so yours should set your PbStatus OK. Use the bool CloseEnough(double num1,double num2) function though when testing the value of v because it is a double and might be holding 2147483647.00000001 rather than 2147483647. I just had a look at your EA code and see you using CloseEnough() there. I see you have declared: static datetime OldPBBarTime; Try assigning it a zero value i.e. static datetime OldPBBarTime = 0; Apart from that, try adapting shift to address a candle you know has a signal. For example, there is a green arrow 4 candles back, so the call would be: v = iCustom(Symbol(), TradingTimeFrame, "PinBar", 0, 4); Alert(v); to show the value of the return from the indi. |
|
| All times are UTC | Page 1 of 2 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|