# Need help with coding - page 9

1259

Thank you very much!

Perhaps I am a little bit silly today, buy what should I do, if I have noch stopLossDistance? Because I want to say absolut, that f.e. 5% of all my money on the account can be risk for the trade.

sunshineh,

Try using this function :

double getLots(string symbol, double Risk, double stopLossDistance)

{

RefreshRates();

double lots = 0;

double MinLots = NormalizeDouble(MarketInfo(symbol,MODE_MINLOT) ,2);

double MaxLots = NormalizeDouble(MarketInfo(symbol,MODE_MAXLOT) ,2);

double LotStep = NormalizeDouble(MarketInfo(symbol,MODE_LOTSTEP),2);

int LotDigit = 2;

if(MarketInfo(symbol,MODE_DIGITS)==3 || MarketInfo(symbol,MODE_DIGITS)==5) stopLossDistance *= 10.0;

//

//

//

//

//

if (LotStep==1) LotDigit=0;

if (LotStep==0.1) LotDigit=1;

if (LotStep==0.01) LotDigit=2;

if (Risk>0)

{

if (AccountBalance()>AccountFreeMargin())

lots = NormalizeDouble(AccountFreeMargin()*(Risk/100.0)/(stopLossDistance*MarketInfo(symbol,MODE_TICKVALUE)),LotDigit);

else lots = NormalizeDouble(AccountBalance() *(Risk/100.0)/(stopLossDistance*MarketInfo(symbol,MODE_TICKVALUE)),LotDigit);

}

//

//

//

//

//

lots = NormalizeDouble(NormalizeDouble(lots/LotStep,0)*LotStep,LotDigit);

lots = MathMax(MathMin(lots,MaxLots),MinLots);

return(lots);

}
145412

sunshineh

You must know the stop loss. Without a known stop loss, you can not calculate the lot size using only the risk. Just a simple example : what would be the maximum price that can be reached if you, for example, open a sell position? So, stop loss is used to calculate what amount (in %) would you allow to loose if the price goes against you for stop loss pips

sunshineh:
Thank you very much! Perhaps I am a little bit silly today, buy what should I do, if I have noch stopLossDistance? Because I want to say absolut, that f.e. 5% of all my money on the account can be risk for the trade.
10

techmac:
That way of opening new order after a loss is not a martingale + martingale works with opened positions

ok but after a win the ea keeps opening another position with the samme amount of lots like the last position it doesnt go back to initial lots .... please help .... example 1 pos 0.1 lots loss 2 pos 0.2 lots win 3 pos 0.2 lots loss ... 4 pos 0.1 lots why this happents i whant theat the ea after a win to go back to initial lots ...

76

Hi all, is it possible to create Gann HiLo Activator using classic rsi (or) iRSI function or if such an indicator already exists.

Good Day everyone.

145412

privateer

Gann high low activator uses sma of high, sma of low and a close. Since rsi does not have a high and low (it is a single value indicator) what is your idea how would it be used to calculate Gann high low activator?

privateer:
Hi all, is it possible to create Gann HiLo Activator using classic rsi (or) iRSI function or if such an indicator already exists. Good Day everyone.
76

was looking for another trend indicator on rsi just found parabolic rsi n QQE

was looking for another trend indicator on rsi just found parabolic rsi n QQE will use these in collaboration with Gann

privateer Gann high low activator uses sma of high, sma of low and a close. Since rsi does not have a high and low (it is a single value indicator) what is your idea how would it be used to calculate Gann high low activator?
145412

Did you try QQE? It is very similar to your idea and it uses RSI in calcuulation

privateer:
was looking for another trend indicator on rsi just found parabolic rsi n QQE will use these in collaboration with Gann Thanks mladen
76

Thank u mladen am working on ur idea

Thank u mladen am working on ur idea ur indicator parabolic rsi is very useful

Did you try QQE? It is very similar to your idea and it uses RSI in calcuulation
3

Hi,

First, I hope I'm right in this thread - if not please tell me...

Second, I tried my success lawst year with manual forex trading - and blew my depot to hell

So, as I recognized that I could eleminate some problems (the ability to watch the market 24/7, control of emotions at a trade, to be forced to have a strategy and the possibility to backtest it) by reanimating my programming skills, I found myself here

And I have a problem with my first selfwritten ea.

I made an ea (VolaRider) which uses two indicators I've found (i guess in this forum...)

##_TEST_STD_DEV_04BIN.mq4 and SuperTrend.

The first one gives me a volatility based (I guess) signal to enter and to leave the market. I modified this indicator a bit, to give him the the variables over the ea.

The second one just tells me if theres an up- or downtrend, to decide if I should open a buy or a sell order.

If I got a signal to enter the market the ea opens several new orders in the same directions at a defined distance (Pyramide).

When the ea gets the signal to leave the market, all orders will be closed at once. The Stoploss is just the emergency exit.

I got several problems with this ea:

1. at the backtest the ea is damn slow. Do I made a programming mistake or why it behaves this way?

2. After I backtested the ea, I took a look at the graphical output. There I could see that it doesn't always entered or left the market when the signal came. I don't have a clue why...

Oh, the best results I have at 15m timeframe.

Could you give my a hand to improve a) my skills and b) my ea?

m

Files:
145412

Of the speed problem : ##_TEST_STD_DEV_04BIN.mq4 is having multiple lops, but one of them is calculating almost all bars on each tick (this loop : for(i = Bars - K_PERIODEN; i >= 0; i--))and that is quite sure slowing down your EA (even in real time, not just in back-testing) So, that indicator needs to be optimized for a normal work first (otherwise it will cause you some problems, even signals missing when it works on all bars all the time can be sometimes a result of that indicators CPU usage %)

Hi,

First, I hope I'm right in this thread - if not please tell me...

Second, I tried my success lawst year with manual forex trading - and blew my depot to hell

So, as I recognized that I could eleminate some problems (the ability to watch the market 24/7, control of emotions at a trade, to be forced to have a strategy and the possibility to backtest it) by reanimating my programming skills, I found myself here

And I have a problem with my first selfwritten ea.

I made an ea (VolaRider) which uses two indicators I've found (i guess in this forum...)

##_TEST_STD_DEV_04BIN.mq4 and SuperTrend.

The first one gives me a volatility based (I guess) signal to enter and to leave the market. I modified this indicator a bit, to give him the the variables over the ea.

The second one just tells me if theres an up- or downtrend, to decide if I should open a buy or a sell order.

If I got a signal to enter the market the ea opens several new orders in the same directions at a defined distance (Pyramide).

When the ea gets the signal to leave the market, all orders will be closed at once. The Stoploss is just the emergency exit.

I got several problems with this ea:

1. at the backtest the ea is damn slow. Do I made a programming mistake or why it behaves this way?

2. After I backtested the ea, I took a look at the graphical output. There I could see that it doesn't always entered or left the market when the signal came. I don't have a clue why...

Oh, the best results I have at 15m timeframe.

Could you give my a hand to improve a) my skills and b) my ea?