Requests & Ideas - page 69

Harsh
9
Harsh  

Request for an EA

Hello,

This is Harsh124.

I wanted some help from our experienced coders out here.

Can anybody help me by creating a two bar High Low trailing stop ea for MT4?

The logic is simple, when we're long the EA automatically calculates the Lowest low of the previous two candles and when we are short the EA calculates the Highest high of the previous 2 candles and places a stop there and it keeps on trailing it till the stop isn't hit.

Can anybody please please please help me here

Harsh124

Miko Wibisono
616
Miko Wibisono  

Indicator data export to csv file

Hi,

I have searched a script that can export indicator's value to a .csv file but none have the following options:

- number of bars to export; for example 2000 bars back from current time

- option to select which indicators to export (standard or custom indicator) and which value to export (an indicator may have several values)

- multiple time frame feature; for example if the script attached to M15 chart it calculates indicator value from H1. Therefore four bars in M15 chart will have the same indicator value derived from H1 timeframe

Currently I export indicators from Neuroshell Day Trader but I realize there are many interesting custom indicators for MT4 that can be used as neural inputs. I really appreciate if great coders here can make the above script.

Cheers

Miko Wibisono
616
Miko Wibisono  
mikono:
Hi,

I have searched a script that can export indicator's value to a .csv file but none have the following options:

- number of bars to export; for example 2000 bars back from current time

- option to select which indicators to export (standard or custom indicator) and which value to export (an indicator may have several values)

- multiple time frame feature; for example if the script attached to M15 chart it calculates indicator value from H1. Therefore four bars in M15 chart will have the same indicator value derived from H1 timeframe

Currently I export indicators from Neuroshell Day Trader but I realize there are many interesting custom indicators for MT4 that can be used as neural inputs. I really appreciate if great coders here can make the above script.

Cheers

I think the simplest method to export standard & custom indicator is like this:

- first I open a chart, then I attach as many indicators that I want to export in that chart (standard and custom indicators)

- the script is thus attached to the chart and automatically detect all indicators and export its values to a .csv file

But I dont know the complexity of such method, because I really am not a coder . But thank you so much if it can be done

William Snyder
9493
William Snyder  
mikono:
Hi,

I have searched a script that can export indicator's value to a .csv file but none have the following options:

- number of bars to export; for example 2000 bars back from current time

- option to select which indicators to export (standard or custom indicator) and which value to export (an indicator may have several values)

- multiple time frame feature; for example if the script attached to M15 chart it calculates indicator value from H1. Therefore four bars in M15 chart will have the same indicator value derived from H1 timeframe

Currently I export indicators from Neuroshell Day Trader but I realize there are many interesting custom indicators for MT4 that can be used as neural inputs. I really appreciate if great coders here can make the above script.

Cheers

Have this indicator that exports data from metatrader to csv file in your experts/files folder, the -1 version has a ma coded into it to give you an idea how to code whichever indicator you want to use and also which format you want it in.In the rar file is an example of the values it gives out.

Files:
Miko Wibisono
616
Miko Wibisono  
mrtools:
Have this indicator that exports data from metatrader to csv file in your experts/files folder, the -1 version has a ma coded into it to give you an idea how to code whichever indicator you want to use and also which format you want it in.In the rar file is an example of the values it gives out.

Thanks a lot mrtools

So if I want to add custom indicator, I just add one line code here:

if (dtval ThruDateTime) continue;

string dt = DateToStr(dtval,DateTimeFmt);

string open = NumberToStr(iOpen(CurrencyPair,TF,k),OHLCFmt);

string high = NumberToStr(iHigh(CurrencyPair,TF,k),OHLCFmt);

string low = NumberToStr(iLow(CurrencyPair,TF,k),OHLCFmt);

string close = NumberToStr(iClose(CurrencyPair,TF,k),OHLCFmt);

string vol = NumberToStr(iVolume(CurrencyPair,TF,k),VolFmt);

string SMA20 = NumberToStr(iMA(CurrencyPair,TF,20,0,MODE_SMA,PRICE_OPEN,k),OHLCFmt);

[/code]

And add additional variable here:

[code]

FileWrite(handle, dt, open, high, low, close, vol, SMA20);

Is that correct?

Sorry for my inability to read codes . Can you fix time format and include column name in csv file output? Here I attached example that I generate from NSDT.

Cheers

Files:
eurusd.zip 178 kb
Harsh
9
Harsh  

No Help on my end?

William Snyder
9493
William Snyder  
mikono:
Thanks a lot mrtools

So if I want to add custom indicator, I just add one line code here:

if (dtval ThruDateTime) continue;

string dt = DateToStr(dtval,DateTimeFmt);

string open = NumberToStr(iOpen(CurrencyPair,TF,k),OHLCFmt);

string high = NumberToStr(iHigh(CurrencyPair,TF,k),OHLCFmt);

string low = NumberToStr(iLow(CurrencyPair,TF,k),OHLCFmt);

string close = NumberToStr(iClose(CurrencyPair,TF,k),OHLCFmt);

string vol = NumberToStr(iVolume(CurrencyPair,TF,k),VolFmt);

string SMA20 = NumberToStr(iMA(CurrencyPair,TF,20,0,MODE_SMA,PRICE_OPEN,k),OHLCFmt);

[/code]

And add additional variable here:

[code]

FileWrite(handle, dt, open, high, low, close, vol, SMA20);

Is that correct?

Sorry for my inability to read codes . Can you fix time format and include column name in csv file output? Here I attached example that I generate from NSDT.

Cheers

Exactly right, you can use any indicator, for time format you can change here

extern string DateTimeFmt = "M-D-Y,H:I"; if i remember right think nuero shell is YYYY.MM.DD enter it this way and should work in nuero shell, give me awhile to become familar with this indicatror, and hopefully will include column name.

William Snyder
9493
William Snyder  

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Mladen Rakic
163288
Mladen Rakic  

Here is the one that does that

Some explanation of options :
regarding high lows :
HighLowPeriod- the period (number of bars) to seek for highs and lows

HighLowStartBar- the first bar to take into account when looking for highs and lows (by default it is set to 1, the first closed bar)

HighLowTimeFrame- time frame to check for highs and lows

general :
TrailAllSymbols- should it trail all the symbols or just the one from the current chart

TrailOnlyInProfit- set trailing stops only when order is already in profit or not

CloseWhenProfit- close orders when specific profit is reached (if 0, it will just manage trailing stops) It is a kind of a hidden take profit (profit specified is in currency, not pips)

magicNumber.from and magicNumber.to - to keep trailing stops only on orders belonging to specified range of magic numbers

showMessages- should it show messages of what is it doing to any of the orders

harsh124:
No Help on my end?
Miko Wibisono
616
Miko Wibisono  
mrtools:
Exactly right, you can use any indicator, for time format you can change here extern string DateTimeFmt = "M-D-Y,H:I"; if i remember right think nuero shell is YYYY.MM.DD enter it this way and should work in nuero shell, give me awhile to become familar with this indicatror, and hopefully will include column name.

It works, excellent Never mind about column name. I can entered it manually, so don't bother writing additional codes.

But I have a little problem. Your indicator put the newest data at the first row and the oldest at the last row; whereas neuroshell needs it the other way around: oldest data at the first row and newest data at the last row