EA tries to open orders over the weekend?

I’m trying to use

if(IsStopped()){ sStat=" *STOPPED*"; Print("EA Stopped"); EAComment(); return; } //- STOPPED

if live trading is stopped …

I am trying to use

if(!IsConnected()){ sStat=" *NO-TICKS*"; Print("Terminal not connected."); EAComment(); return; } //- NO TICKS

if the EA is not connected to the broker …

and on top of that(on a side note)

I am trying to stop EA if there is not enough bars

if(Bars<MA_Period){ sStat=" *NO-BARS*"; Print("Not enough bars for calculation. Bars: " + IntegerToString(Bars)); EAComment(); return; } //- NO BARS

if I go to weekly chart it says bars is 118… then how can moving average 200 period even be displayed?

This last one doesn’t seem to work appropriately …

Anyway I get an error from the EA trying to open orders

if(ticket<=0){Print("OrderSend Error: ",strError(GetLastError()));}

case 4109: return(“Trade Is Not Allowed In The Expert Properties”);

Well this doesn’t make sense either, because it’s the weekend, terminal is connected …

And I have been reading the CheckUp and getting no where is basically why I seek help

if (!IsTradeAllowed()) {
      Alert("Please Enable Auto Trading to run this EA");

Oh I think its working

if( !IsTradeAllowed(Symbol(),Time[0]) ) return;

It just doesn’t seem to be the right usage for prohibiting trading over the weekend

Now I’ve got OnTick like this

 if(!IsConnected() || !IsTradeAllowed(strSymbol,Time[0])){ sStat=" *NO-TICKS*"; EAComment(); return; } //- NO TICKS/STOPPED
 if(Bars<MA_Period){ sStat=" *NO-BARS*"; EAComment(); return; } //- NO BARS

And it doesn’t allow trades over the weekend …

But about Bars? On Weekly chart theres only 118 bars and it’d not enough to make a 200 period moving average calculation.

So theres bars in chart set to 65000 and then bars in history set to 512000 …

Bars reads 118 and yet moving average displays

Well Brian what can we say ?


Number of bars in the current chart.