What could go wrong with EA Trading

 

This is not about entries or exits but the unscene things

and what coders and traders do to get around problems such as

Power cuts.

Auto restarting the EA after the power cut

Stopping EA from opening position when restarted.

I'm sure there are alot of new coders and traders that don't think of these sorts of minor problems.

I don't have the answers but it would be interesting to find out some solutions to common problems.

Please add to the list

Cheers

Beno

 

Good idea for a thread Beno!

Lots of great advise could be shared here.

For me, I always use magic numbers, or the total of magic numbers, to keep track of my orders. Useful if an EA gets re initialized in the middle of a trading sequence.

I created a function I use to simplify this process.

int OTBM(int intMagic)//OrdersTotalByMagic

{

int intCount=0;

int intPOS=0;

bool boolTerm=false;

while(boolTerm==false)

{

if(OrderSelect(intPOS,SELECT_BY_POS))

{

if(OrderMagicNumber()==intMagic) intCount++;

intPOS++;

}

else

boolTerm=true;

}

return(intCount);

}[/PHP]

You can use this function to return the number of open orders with a specific magic number.

EX:

[PHP]int Magic_Number = 523549;

Print("Total number of orders open with Magic Number ",Magic_Number," = ",OTBM(Magic_Number));
 

The best way to circumvent all the problems you listed, and the one I and many others use, is to get a cheap VPS and run your EA's from there.

Good Luck

Lux

PS: Wolfe, how would your function help in any of the instances stated by the OP? I know what it's doing but don't see how that would help you in the event of a power outage etc. Just curious.

 

luxinterior very good point vps is a very good way to solve the power cut and connection problems.

I have not put any systems on a vps so I will have to read that thread to see what problems there are.

Would you agree that 95% of people using an EA would not put a systems onto a vps but would have it on the home computer.

That being the case how would people get over the loss of conection problems?

cheers

Beno

 
wolfe:
Good idea for a thread Beno!

Lots of great advise could be shared here.

For me, I always use magic numbers, or the total of magic numbers, to keep track of my orders. Useful if an EA gets re initialized in the middle of a trading sequence.

I created a function I use to simplify this process.

int OTBM(int intMagic)//OrdersTotalByMagic

{

int intCount=0;

int intPOS=0;

bool boolTerm=false;

while(boolTerm==false)

{

if(OrderSelect(intPOS,SELECT_BY_POS))

{

if(OrderMagicNumber()==intMagic) intCount++;

intPOS++;

}

else

boolTerm=true;

}

return(intCount);

}[/PHP]

You can use this function to return the number of open orders with a specific magic number.

EX:

[PHP]int Magic_Number = 523549;

Print("Total number of orders open with Magic Number ",Magic_Number," = ",OTBM(Magic_Number));

Thanks Wolfe

So the above code would help prevent a position opening on a restart if a position is already open on that.

 
Beno:
Thanks Wolfe So the above code would help prevent a position opening on a restart if a position is already open on that.

No it wouldn't, hence my PS to Wolfe.

As for the 95% statistic and question I've never heard of that figure so I couldn't comment on it. What I can say with certainty is anybody serious about using EA's and concerned about power outages, such as myself, would go with a VPS. It's just the only sensible thing to do really.

Good luck

Lux

 
luxinterior:
No it wouldn't, hence my PS to Wolfe.

As for the 95% statistic and question I've never heard of that figure so I couldn't comment on it. What I can say with certainty is anybody serious about using EA's and concerned about power outages, such as myself, would go with a VPS. It's just the only sensible thing to do really.

Good luck

Lux

Nice answer from the voice of experience.

I will look for a good VPS service.

The 95% that pure guess work.

Cheers

Lux

 
luxinterior:
PS: Wolfe, how would your function help in any of the instances stated by the OP? I know what it's doing but don't see how that would help you in the event of a power outage etc. Just curious.

Looking at the original question you are right. I just use this function to help an EA "pick-up" where it left off in the event of a connection loss. The function is called in various sections of my code, so it can help me determine where I am at a given time.

I was just trying to share something I use that I have found helpful in basic structure and functionality in an EA.

Reason: