help needed

 

pls i would like my EA to be trading between 7p.m to 12p.m but i didnt work the way i expected below is the code used.

extern string start="7:00";
extern string finished="12:00";

int start()
{



if (TimeCurrent()<StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+start)+Duration)return(0);
if( TimeCurrent()>StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+finished)+Duration)return(0);

looking forward to see your help. thanks

 
keylove:

pls i would like my EA to be trading between 7p.m to 12p.m but i didnt work the way i expected below is the code used.

extern string start="7:00";
extern string finished="12:00";

int start()
{



if (TimeCurrent()<StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+start)+Duration)return(0);
if( TimeCurrent()>StrToTime(TimeToStr(TimeCurrent(), TIME_DATE)+" "+finished)+Duration)return(0);

looking forward to see your help. thanks

if(TimeCurrent() < StrToTime(start)) return(0);
if(TimeCurrent() > StrToTime(finished)) return(0);

 
Try the datetime operations used in this.
 
Sorry... here : https://forum.mql4.com/32577
 

Hello every one,

I am a NEWBIE & just trying to find my way around writing EAs. Do you think this will work? Any HELP will be appreciated.

Thanks and regards,

[b] Yburex23 [/b]
Strategy name: [b]USDJPY_15June2010[/b]
Exported on: 6/15/2010 6:05:29 PM

[b]Description[/b]
Automatically generated on 6/15/2010 5:53 PM.

Market: USDJPY 1 Day
Spread in pips: 3
Swap Long in pips: 1
Swap Short in pips: -1
Commission per lot at opening and closing in pips: 0
Slippage in pips: 0

Maximum open lots: 20
Entry lots: 1
Adding lots: 1
Reducing lots: 1

Intrabar scanning: Accomplished
Interpolation method: Pessimistic scenario
Ambiguous bars: 0
Tested bars: 2297
Balance: [b]1712 pips (3372.40 JPY)[/b]
Minimum account: -145 pips (1584.67 JPY)
Maximum drawdown: 371 pips (294.81 JPY)
Time in position: 7 %

[b]A same direction signal[/b] - [i]Does nothing[/i]
[b]An opposite direction signal[/b] - [i]Does nothing[/i]
[b]Permanent Stop Loss[/b] - [i]None[/i]
[b]Permanent Take Profit[/b] - [i]None[/i]

[b][Opening Point of the Position][/b]
[b][color=blue]Bar Opening[/color][/b]
[b][color=teal]Enter the market at the beginning of the bar[/color][/b]
[b]Base price[/b] - [i]Open[/i]

[b][Opening Logic Condition][/b]
[b][color=blue]Momentum MA Oscillator[/color][/b]
[b][color=teal]The Oscillator crosses the zero line downward[/color][/b]
[b]Smoothing method[/b] - [i]Weighted[/i]
[b]Signal line method[/b] - [i]Smoothed[/i]
[b]Base price[/b] - [i]Typical[/i]
[b]Momentum period[/b] - [i]12[/i]
[b]Signal line period[/b] - [i]199[/i]
[b]Use previous bar value[/b] - [i]Yes[/i]

[b][Opening Logic Condition][/b]
[b][color=blue]Enter Once[/color][/b]
[b][color=teal]Enter no more than once a month[/color][/b]

[b][Closing Point of the Position][/b]
[b][color=blue]Bar Closing[/color][/b]
[b][color=teal]Exit the market at the end of the bar[/color][/b]
[b]Base price[/b] - [i]Close[/i]

[b][Closing Logic Condition][/b]
[b][color=blue]Volumes[/color][/b]
[b][color=teal]The Volume rises[/color][/b]
[b]Level[/b] - [i]1000[/i]
[b]Use previous bar value[/b] - [i]No[/i]

Reason: