Can anyone answer why this may not work? - page 2

 
wadem000 wrote >>

Still offering to help if I can.

Since you do not want to post the entire app, extract the portion that is not working (complete with variable definitions).

Make a copy and prune the EA down to the variable definitions and the function that is not working. Test the pruned version. If it is still not working, post that pruned version only.

You will get more assistance that way; if we can see the "entire" program instead of just seeing an extract of what is not working. The problems are big and a waste of time. Take advantage of the forum while protecting your ideas

Consider pruning your code and posting it here to get help.

Now that is constructive criticism! I will do that and post it here:

int start()
{
int ticket1;
int totalO = OrdersTotal();
int Slippage=3;
double M14A=iMA(Symbol(),240,14,0,MODE_SMA,PRICE_OPEN,1);
double M14B=iMA(Symbol(),240,14,0,MODE_SMA,PRICE_OPEN,7);
double M14C=iMA(Symbol(),240,14,0,MODE_SMA,PRICE_OPEN,8);
double M55A=iMA(Symbol(),240,55,0,MODE_SMA,PRICE_OPEN,1);
double M55B=iMA(Symbol(),240,55,0,MODE_SMA,PRICE_OPEN,7);
double M55C=iMA(Symbol(),240,55,0,MODE_SMA,PRICE_OPEN,8); THESE ARE THE INDICATOR VALUES THAT NEED ASSESSING
double MDHA=iMACD(Symbol(),240,12,25,9,PRICE_CLOSE,MODE_MAIN,1);
double MDHB=iMACD(Symbol(),240,12,25,9,PRICE_CLOSE,MODE_MAIN,7);
double MDHC=iMACD(Symbol(),240,12,25,9,PRICE_CLOSE,MODE_MAIN,8);
double LB=iBands(Symbol(),15,21,3,0,PRICE_OPEN,MODE_LOWER,0);
double UB=iBands(Symbol(),15,21,3,0,PRICE_OPEN,MODE_UPPER,0);

if(totalO == 0 && GlobalVariableCheck("STOP")==false)
{
stuff inserted here to place orders>>>>>>>>>>>> THIS PART OF CODE WORKS FINE.
}

------------------------------------------------------------------------------------------------------------------------

bool found = false;
for(int k=OrdersHistoryTotal()-1;k>=0;k--)
{
if((OrderSelect(k,SELECT_BY_POS,MODE_HISTORY))&&(OrderMagicNumber()==MagicNumber99))
{
found = true;
break;
}
} THIS IS FOR DELETING ONE ORDER ONCE ONE IS CLOSED
if(found == true)
{
for(k=OrdersTotal()-1;k>=0;k--)
{
if((OrderSelect(k,SELECT_BY_POS,MODE_TRADES))&&(OrderMagicNumber()==MagicNumber98))
{
OrderDelete(OrderTicket());
}
}
}

-------------------------------------------------------------------------------------------------------------------------

if(DayOfWeek()!=1 && Hour()==0)//if day isnt Mon and hour 0 we are deleting trade mode global variables and setting new
{
GlobalVariableDel("buy");
GlobalVariableDel("sell");
GlobalVariableDel("BUY"); ONCE DAY IS NEW(HR=0), WANT GLOBAL VARIABLES DELETED HERE
GlobalVariableDel("SELL");
GlobalVariableDel("STOP");
Print("Reset has taken place");

if (Seconds() < 40)//looks to set globalvariables to determine how to trade
{
if(M14A > M14B && M55A > M55B && MDHA > MDHB)
{
GlobalVariableSet("BUY",1);//sets strong BUY mode WANT THESE CONDITIONS TO SET TRADING MODE USING GLOBALVARIABLES
Print("BUY mode has been set"); MY POOR CONSTRUCTION WORKS, BUT NOT IDEALLY
} BOOLEAN CONSTANT MAY WORK BETTER?
if(M14A < M14B && M55A < M55B && MDHA < MDHB) SHOULD I SET UP AN ARRAY FOR LOOKING BACK UP TO 8 BARS?
{
GlobalVariableSet("SELL",1);//sets strong SELL mode
Print("SELL mode has been set");
}
Print("Sessions trade mode has been set");
}//end of monday condition

//----
return(0);
}

 
Roger wrote >>
If I offended you, I'm sorry, but English isn't my native language and I couldn't explane you all nuances of code without this code. I didn't try to insult you.

ROGER....NO PROBLEM. I UNDERSTAND.....AFTER SEEING YOU HAVE POSTED IN ANOTHER LANGUAGE, I FIGURED AS MUCH. NOTHING CAN REPLACE ACTUALLY TALKING TO SOMEONE! I APOLOGIZE FOR OVERREACTING.......I KNOW MY CODING IS POOR....I KNOW JUST ENOUGH TO GET BY AND SOMETIMES CAN MAKE IT DO WHAT I NEED IT TO :) THANKS FOR LOOKING AT THINGS.......

 
forexman05 wrote >>

ROGER....NO PROBLEM. I UNDERSTAND.....AFTER SEEING YOU HAVE POSTED IN ANOTHER LANGUAGE, I FIGURED AS MUCH. NOTHING CAN REPLACE ACTUALLY TALKING TO SOMEONE! I APOLOGIZE FOR OVERREACTING.......I KNOW MY CODING IS POOR....I KNOW JUST ENOUGH TO GET BY AND SOMETIMES CAN MAKE IT DO WHAT I NEED IT TO :) THANKS FOR LOOKING AT THINGS.......

It me again.

The code you posted does not compile.

It seems to me from your first post that something discreet is not working. I exected that you would isolate the non-working function, along with the variable definitions needed to make that function not fail when called.

What you have posted references global variables which are not set on my system. I do not know how they are set. Most likely they are set by another Indicator or EA. It is necessary that you completely isolate what is NOT working. and post that only. Before posting, compile your pruned version and test it so that you can demonstrate the failure via the forum. Then we can quickly assist. When I have a bug in my own code, I often go onto a forum or two to clear my head, see what is going on, etc. There is often not enough time to look at a lot of code. I expect that others do the same. In this case, less is better to get a quick and concise response.