Ask! - page 33

 
AnasFX:
Thanks for the idea man. I also wants to know the time of its stop-loss and if that time is in the current bar. I may have lots of stop-losses, but I want to know if it hits the stop-loss in the current time bar. Should I check the order close time and compare it with the time of the current bar?

in that loop you can check all related whit the order... function

try search the word "order" in the "search" tab of the "Navigation" window

you will find all function about order

to compair with the bar time use Time[0] or iTime(..) function

like if(orderclosetime()>Time[0]) blockopen=true;

 
marketjouster:
Thanks very much Yannis. Your explanation is very clear and I appreciate the inclusion of the actual code. Could I pose a follow-up question? If I wanted to be able to adjust the number of pips for the long bar in the expert advisors properties window, could I use;

extern int LBE=30; // LBE is 'Long Bar Entry'. Default could be 30

in the header section of the expert and then use LBE instead of 30 in your line of code?

if MathAbs(Close[1]-Open[1])<(LBE*Point)

This would allow me to test variant pip settings manually, and to optimize it in back testing.

MJ

MJ,

Sorry for the late reply, you probably have figured out yourself by now, but yes you are correct. This will allow the user to change the value through the ea parameters without modifying your code.

 

Using Arrays to track info for All Open Orders

Could someone show me a snippet of an array for logging the details for all open orders? I want to be able to track information on all Open orders such as OrderOpenPrice and order profit. Then I would like to use the information in the array to find the minimum and maximum values. I've tried all sorts of thing but nothing seems to work.

Thanks in Advance!!!

dee

 
phoenix:
in that loop you can check all related whit the order... function

try search the word "order" in the "search" tab of the "Navigation" window

you will find all function about order

to compair with the bar time use Time[0] or iTime(..) function

like if(orderclosetime()>Time[0]) blockopen=true;

Ok it worked, but now the problem is performance. Checking the whole history takes time. I did a backtest for a year and a half period and I noticed that it is slow. The reason is that I am checking all orders in history and compare thier close price and close time. So, is there anyway to limit the history search to make it search only the recent orders? Can I increase the performance anyhow?

 

How to Disable EA on the definite day

Dear colleagues!

Are there exist possibilities to create piece of code which can disable opreation of Expert Advisor on the definite week's day, for example: Monday, Tuesday...etc.?

I'm not a programmer and that's why I ask for Your advice & help

Best regards,

Warren

 

To iscuba11 !

Thanks a Lot for Your response!

 
if (UseHourTrade)

{

int a=0;

int b=0;

int c=0;

if(!(Hour()>=FromHourTrade1 && Hour()<=ToHourTrade1)) a=1;

if(!(Hour()>=FromHourTrade2 && Hour()<=ToHourTrade2)) b=1;

if(!(Hour()>=FromHourTrade3 && Hour()<=ToHourTrade3)) c=1;

if(a==1 && b==1 && c==1)

{

Comment(

"\n"," * SOLAR WIND EXPERT ADVISOR *",

"\n",

"\n", " - PROGRAM IN SLEEP CYCLE - ",

"\n",

"\n"," > NON-TRADING HOURS! <");

return(0);

}

}

[/PHP]

Adapt this code using below:

[PHP]int DayOfWeek( )

Returns the current zero-based day of the week (0-Sunday,1,2,3,4,5,6) of the last known server time.

Note: At the testing, the last known server time is modelled.

Sample:

// does not work on holidays.

if(DayOfWeek()==0 || DayOfWeek()==6) return(0);

extern bool UseHourTrade=false; Change statements to: UseDayOfWeek=false;

extern bool Monday=true;

extern bool Tuesday=true;

extern bool Wednesday=true;

extern bool Thursday=True;

extern bool Friday=True;

Good Luck! P.S. || is the same as (or). Try substituting Hour() with: if(!(DayOfWeek()=2 && Tuesday=true)) a=1;

I am not an expert at coding, but this should get you in the ballpark!

 

Choppy or flat market

Anybody can recommend indicator that shows choppy or flat market, when not to trade

euro

 

How do you Transfer Variable value from indicator to An EA??

////////////////////INDICATOR VALUES/////////////////////////

HourChannel_v1.MQ4

Setup: Hours = 3;

double Width=0;

Width = price_p0-price_02;

Comment("",

"\n",

"\n","Current High Channel = ",price_p0,

"\n","Current Low Channel = ",price_02,

"\n","Current Width = ",Width

);

///////////////////////////////////////////////////////////////////////////////////

////////////////////////////////NEED HELP BELOW//////////////////////////////

>>>How do I create a statement to transfer the "Width" variable value from the Hour Channel indicator into an EA????

double val= iCustom(NULL,0,"HoursChannel_v1",(NOW WHAT??)

Please Lend Me Your Expertise - Important!!

 

JMA Slope

JMA Slope on the bottom shows good and flat trading.

Files:
jma_slope.bmp  1675 kb
jmaslope.mq4  12 kb