Ask! - page 103

 

I want to code to hold a trade for 3 hours but the server time rolls over

from 23:00 to a new time.

How do I exit in 3 hours? ANy suggestions?

 

Realized I had the answer already!

 

Finding RSI High and Low Bars

RSI = 5;

How do I find the number of the most recent bar back of the RSI that has the highest RSI and is also above 75, likewise the most number of the recent bar back of RSI that has the lowest RSI which is also below RSI of 25?

This has me puzzled! Can you help with the statement to solve this??

Much appreciation in advance for your time and effort!

Dave

 
Dave137:
RSI = 5;

How do I find the number of the most recent bar back of the RSI that has the highest RSI and is also above 75, likewise the most number of the recent bar back of RSI that has the lowest RSI which is also below RSI of 25?

This has me puzzled! Can you help with the statement to solve this??

Much appreciation in advance for your time and effort!

Dave

Maybe:

Lowest_RSI=MathMin(Lowest_RSI,iRSI(NULL,0,Periods,MODE,i)); Highest_RSI=MathMax(Highest_RSI,iRSI(NULL,0,Periods,MODE,i));
 

Thanks Linuxser!

I have never used this statement before and now I shall add this to my collection for future reference. You made my day, and now I can proceed with my logic for my EA.

May God Bless You and give you a Long and Healthy Life!

Dave

 
Linuxser:
Maybe:
Lowest_RSI=MathMin(Lowest_RSI,iRSI(NULL,0,Periods,MODE,i)); Highest_RSI=MathMax(Highest_RSI,iRSI(NULL,0,Periods,MODE,i));

This gives me the value at a lowest or highest particular RSI bar, but I also need to find out the bar back number for i.

There is a statement:

Highest_bar = iHighest(NULL,0,MODE_HIGH,BarsBack,StartBar)

that gives me the highest bar back number, but I need a modified statement to work with the RSI. Any suggestions on this??

Dave

 

Hai GURU,

I have problem with my EA, I use buystop and sellstop with TP.

In by backtest, most of times it could execute with no problem but other times it's error INVALID_STOPS (130)

I already check when it's error, my active price and pending position in acceptable range.

What happen ?

Thanks in advance

 
Goen:
Hai GURU,

I have problem with my EA, I use buystop and sellstop with TP.

In by backtest, most of times it could execute with no problem but other times it's error INVALID_STOPS (130)

I already check when it's error, my active price and pending position in acceptable range.

What happen ?

Thanks in advance

Try to use NormalizeDouble(price,Digits). Sometimes price of metatrader is not 1.2000 but 1.20020031023012 and the rest of the digits is a problem for metatrader when placing pending order. Use NormalizeDouble and it will be ok

 
Dave137:
This gives me the value at a lowest or highest particular RSI bar, but I also need to find out the bar back number for i.

There is a statement:

Highest_bar = iHighest(NULL,0,MODE_HIGH,BarsBack,StartBar)

that gives me the highest bar back number, but I need a modified statement to work with the RSI. Any suggestions on this??

Dave

Here is the suggestion:

add your rsi values to an array, and then use ArrayMaximum and ArrayMinimum functions. They return index of array instead of value, so you will know which i is it.

 

I will try to work with the array.

Thanks

Dave

Reason: