[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 950

 
Help me add levels to the indicator to make a channel
Files:
hp_1.mq4  3 kb
 
smogsam:

Hello all!

I have this problem: I can't figure out the Trend Magic indicator. I attach it to my Expert Advisor, but I can't get the right trading conditions from it.

MA_1_1=iCustom(NULL,0, "TrendMagic",CCPeriod,ATRPeriod,0,0); // Blue

MA_2=iCustom(NULL,0, "TrendMagic",CCPeriod,ATRPeriod,1,0); // Red

I have already racked my brains.

The order is closing with a delay or opening with a delay, but everything is working fine. I don't understand it at all. Maybe the indicator does not work in the right way. What is the correct way to write the entry-exit conditions for the indicator line colour change?

Please advise how to do this.


The code is decompiled. Post deleted
 
smogsam:

Hello all!

I have this problem: I can't figure out the Trend Magic indicator. I attach it to my Expert Advisor, but I can't get the right trading conditions from it.

I have already racked my brains.

I have a delayed order closure and a delayed order opening but everything is working fine. I do not understand what I am trying to do. Maybe the indicator is working in the wrong way. How to correctly write entry/exit conditions for indicator line colour change?

Please advise.

The code is decompiled. Post deleted. Made a submission to the ban
 
smogsam:

Hello all!

I have this problem: I can't figure out the Trend Magic indicator. I attach it to my Expert Advisor, but I can't get the right trading conditions from it.

I have already racked my brains.

I have a delayed order closure and a delayed order opening but everything is working fine. I do not understand what I am trying to do. Maybe the indicator is working in the wrong way. How to correctly write entry/exit conditions for indicator line colour change?

Please tell me.
By all indications this is a RISING turkey. The signals on the history are very beautiful. I advise you to follow this indicator in the real time on the minutes. Most likely, depending on the current signal the historical curve of this indicator will be redrawn
 
Stepan241:
For all intents and purposes it is a RISING turkey. The signals on the history are very beautiful. I advise you to follow this indicator in the real time on the minutes. Most likely, depending on the current signal the historical curve of this indicator will be redrawn

I do not think so. It does not change the signal if that is what you mean. I do not even know what it depends on. The signal is correct, then it is delayed by 1 bar.


Can I compare the colour of the line instead of the indicator calculations? How to get out of this situation? Is there anything I can do to make it all right?

 
artmedia70:

My understanding is that from this particular stop-locked position, with a particular ticket, you need to open once to the opposite side if this position is stop-locked. Right?

Then remember the ticket for the pose you have already opened in the opposite direction and check the ticket along with the other checks I have written. If the opposite pose has already been opened from the position with this ticket, do not open any more.


Exactly this is what I described with this logic, with a ticket, so with a ticket, I don't understand how to implement it better in code. Apart from an array nothing comes to mind. Thanks to those who respond.
 

Hello.

Can you please tell me how to make an EA to change the lot depending on the result of a previous trade?

For example, if previous trade was losing, then next one will be with lot=lot-A, and if it was profitable, then lot=lot+B, where A and B are constants, something like that.

Maybe it can be done with a balance, but I can't figure it out myself :-(

or maybe there is another way out.....

 
chum:

Hello.

Can you please tell me how to make an EA to change lot depending on the result of a previous trade?

For example, if previous trade was losing, then next one will be with lot=lot-A, and if it was profitable, then lot=lot+B, where A and B are constants, something like that.

Maybe it can be done with a balance, but I can't figure it out myself :-(

or maybe there's another way out.....

At one time I wrote a procedure which returns the profit/loss of the last trade. Here it is. Somebody already used it. If necessary, add MAGIC yourself.

//Function Last trade profit------------------------------------------------------------------------------------------------------------------------
double _OldProfit()
{
for(int i=OrdersHistoryTotal()-1;i>=0;i--) //lists all orders for all currencies
{
if (OrderSelect(i,SELECT_BY_POS, MODE_HISTORY)==true) //if an order is successfully selected
{
if (OrderSymbol()!=Symbol())continue; // if the selected order is in the wrong currency, continue the search
{
double Ord_Profit=OrderProfit();
break;
}
}
}
return(Ord_Profit);
}

 
Can you tell me how to make the EA code to be executed not every tick, but with every new bar. Thanks in advance!
 
pr0fess0r64:
Can you suggest how to make the EA code be executed not every tick, but with every new bar. Thank you in advance!

This is the standard procedure described at the beginning of START. Implementation by number of BARs


bool isNewBar=false;

int ExpertBars;

if (ExpertBars !=Bars) {ExpertBars=Bars; isNewBar=true; }

if (isNewBar)

{
your program code
}

The meaning should be clear. All kinds of modifications are possible.

Here's another implementation for TIME

if (Time[0] == prevtime) return(0);
prevtime = Time[0];

Reason: