MQL4 - automated forex trading   /  

Forum

Help I am trying to write an EA that requires pivot points

Back to topics list To post a new topic, please log in or register

avatar
31
faqcya 2007.10.11 10:23 

Hello, I need some help please i am trying to write a bot that requires pivot points, my problem is that all i get from the iHigh, iLow, and iClose values are 0's. I figured out that i could use the ihighest and ilowest to obtain these 2 values however what can i do about iclose. Thanks for your time.

article

Strategy Tester: Modes of Modeling during Testing

Many programs of technical analysis allow to test trading strategies on history data. In the most cases, the testing is conducted on already completed data without any attempts to model the trends within a price bar. It was made quickly, but not precisely


avatar
2462
phy 2007.10.11 16:17 

Post your code .


avatar
31
faqcya 2007.10.11 23:09 

This Line of code produces nothing but zeros.



Comment("GBPUSD Close: ", iClose("GBPUSD",PERIOD_D1,1)); 

avatar
2462
phy 2007.10.12 00:07 
faqcya wrote:

This Line of code produces nothing but zeros.



Comment("GBPUSD Close: ", iClose("GBPUSD",PERIOD_D1,1)); 


A possibility:

double iClose( string symbol, int timeframe, int shift)
Returns Close value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0.


avatar
31
faqcya 2007.10.12 01:15 
How do you load local history?

avatar
2462
phy 2007.10.12 01:21 

Open a Daily Chart for GBPUSD.

This may not be your problem, but you haven't given much to work with.

Also, you can open the History Center. Open up a pair, grayed out time periods
seem to indicate it is not or not yet collecting a history for that time period.

Double click grayed out times and they become colored.

The download button at the bottom downloads from Metaquotes, not your
dealer database. It gives a warning about that.


avatar
31
faqcya 2007.10.12 01:50 

Heres the code


avatar
31
faqcya 2007.10.12 01:54 

Lets try this again:

double R1, R2, R3, PP, S1, S2, S3, H, L, C, Range;

//H=High[est(NULL,PERIOD_D1,MODE_HIGH,1,1)];

//L=Low[est(NULL,PERIOD_D1,MODE_LOW,1,1)];

C=iClose("GBPUSD", PERIOD_D1,1);

H=iHigh("GBPUSD", PERIOD_D1,1);

L=iLow("GBPUSD", PERIOD_D1,1);

Range=H-C;

PP =(H+L+C)/3 ;

R1 = (2*PP) - L;

R2 = PP+Range;

R3 = PP+(Range*2);

S1 = (2*PP) - H;

S2 = PP+Range;

S3 = PP+(Range*2);

Comment("Yesterdays High: ", H, " Yesterdays Low: ", L, " Yesterdays Close: ", C, " Range: ", Range, " PP= ", PP, " R1= ", " R2= ", R2, " R3= ", R3, " S1= ", S1, " S2= ", S2, " S3= ", S3, " RSI: ", iRSI(NULL, PERIOD_D1,9,PRICE_CLOSE,1));


avatar
31
faqcya 2007.10.12 01:57 
tried puting it on a daily chart, tried downloading the chart, made sure it wasn't greyed out in history center, still 0's

avatar
31
faqcya 2007.10.12 02:01 
It compiles fine and i get an accurate reading for the RSI, but nothing else

avatar
2462
phy 2007.10.12 02:51 

Using that code above works here. Gives values, looks like they might be right.

Replace "GBPUSD" with Symbol() for a test.

C=iClose(Symbol(),PERIOD_D1,1);

H=iHigh(Symbol(),PERIOD_D1,1);

L=iLow(Symbol(),PERIOD_D1,1);

Print("Format of this pairname is ", Symbol());

Check terminal for the printout.

Back to topics list  

To add comments, please log in or register