Metatrader 5 coding questions / issues - page 20

 

Hi Mladen,

I write also in this section for your help....

A friend of mine convert the following indicator...but it is wrong....so,can you convert it?where is the problem?

thank's in advance.

Files:
zigpips.mq4  5 kb
zigpips.mq5  8 kb
 
carbonmimetic:
Hi Mladen,

I write also in this section for your help....

A friend of mine convert the following indicator...but it is wrong....so,can you convert it?where is the problem?

thank's in advance.

carbonmimetic

Try this one out : zigpips_1.mq5

Files:
zigpips_1.mq5  7 kb
zigpips.gif  64 kb
 

it is ok...thank you very much!!!!!!

 

My idea with 3 stochastic indicators using three different periods. If all going in the same direction, i will get a alert!

Does anyone know of such an indicator or EA in MQ5?

Files:
3s.jpg  118 kb
 

Mladen,

I have been away from forex for a while and I'm back now on mql5 programming. Please I have a question.

How can I code: if stop loss is hit on the same bar where buy/sell is placed, don't open another trade (even when the condition to open trade still exist on the bar). I have attached a picture to illustrate.

Files:
samebar.jpg  59 kb
 

Also Mladen,

How does one code:

1. If last trade profit is negative (that is loss) next trade take profit = last loss value + 5 pips.

For example trade Profit = -30pips. Then next trade take Profit = 30pips +5 pips.

2. If last two or more consecutive trades sum in a day is still negative make next trade take profit loss + 5pips.

For example trade profit 1 = -30 pips, trade profit 2 = 20pips, then

next trade take profit = trade profit 1(-30pips) + trade profit2(20pips) + 5pips = abs(-30+20)+5 = 15pips.

3. Clear the profit and loss condition/calculation for the day and start new one for each new day. That is from 0 hour to 24 hour (platform time).

Thanks in advance.

 
funayot:
Mladen,

I have been away from forex for a while and I'm back now on mql5 programming. Please I have a question.

How can I code: if stop loss is hit on the same bar where buy/sell is placed, don't open another trade (even when the condition to open trade still exist on the bar). I have attached a picture to illustrate.

However I check there is no such thing as close time (not for orders, deals or positions)

Checking more but for now can not find data that could help

 
mladen:
However I check there is no such thing as close time (not for orders, deals or positions) Checking more but for now can not find data that could help

Thanks Mladen.

Also what about this?

Also Mladen,

How does one code:

1. If last trade profit is negative (that is loss) next trade take profit = last loss value + 5 pips.

For example trade Profit = -30pips. Then next trade take Profit = 30pips +5 pips.

2. If last two or more consecutive trades sum in a day is still negative make next trade take profit loss + 5pips.

For example trade profit 1 = -30 pips, trade profit 2 = 20pips, then

next trade take profit = trade profit 1(-30pips) + trade profit2(20pips) + 5pips = abs(-30+20)+5 = 15pips.

3. Clear the profit and loss condition/calculation for the day and start new one for each new day. That is from 0 hour to 24 hour (platform time).

 
funayot:
Thanks Mladen.

Also what about this?

Also Mladen,

How does one code:

1. If last trade profit is negative (that is loss) next trade take profit = last loss value + 5 pips.

For example trade Profit = -30pips. Then next trade take Profit = 30pips +5 pips.

2. If last two or more consecutive trades sum in a day is still negative make next trade take profit loss + 5pips.

For example trade profit 1 = -30 pips, trade profit 2 = 20pips, then

next trade take profit = trade profit 1(-30pips) + trade profit2(20pips) + 5pips = abs(-30+20)+5 = 15pips.

3. Clear the profit and loss condition/calculation for the day and start new one for each new day. That is from 0 hour to 24 hour (platform time).

funayot

In all the conditions, the main problem is that we do not have a closing time of an order or deals (nor positions) and that we can not determine which one was the last executed . Metatrader explicitly stated that they do not guarantee that either reading the orders by position or by ticket will honor some ascending (or descending) by time order. So, we do not have a normal way of finding out from the trading history the data you need

 
mladen:
funayot In all the conditions, the main problem is that we do not have a closing time of an order or deals (nor positions) and that we can not determine which one was the last executed . Metatrader explicitly stated that they do not guarantee that either reading the orders by position or by ticket will honor some ascending (or descending) by time order. So, we do not have a normal way of finding out from the trading history the data you need

How do they sort those things then out?

Reason: