[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 877

 

Why, the expression A=Close [1] is not valid?????????? The result is always 1 !!!!!!!!!!!!!

Also here is always 1 extern int Bar; B=Close [Bar];

And here it is always 0 C=A-B ; , and here it is always zero int difference=Close [1] - Close [Bars]; People, tell me, I am confused,

 
Dimka-novitsek:

Why, the expression A=Close [1] is inappropriate??????????

Ask a lawyer.
 
Really, where's the problem??? How do you even tell the difference???
 
Dimka-novitsek:

Why, the expression A=Close [1] is not valid?????????? The result is always 1 !!!!!!!!!!!!!

Also here is always 1 extern int Bar; B=Close [Bar];

And here always 0 C=A-B ;, and here always zero int difference=Close [1] - Close [Bars]; Folks,hint, something is stupid,

Show me the full code with the prints. You are just messing up somewhere. And don't call variables in Russian letters - the stupidest programming tone.
 


//+------------------------------------------------------------------+
//| Dimon's Bars.mq4
//| Copyright © 2010, MetaQuotes Software Corp.
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
extern double volume;
extern double volume,stoploss,takeprofit;
extern inttern bars;
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{ int A,B,C;
A=Close [1];B=Close [bars];
C=A-B ;
int difference=Close [1]-Close [Bars];

int slippage=3;
Comment("Close [B] ", B);


while(difference> slippage)
OrderSend ( Symbol(), OP_BUY, volume, Ask, slippage,Bid-stoploss*Point,
Bid+takeprofit*Point, NULL, 0, 0, Red) ;

while(0-difference>Point)
OrderSend (Symbol(), OP_SELL, volume, Bid, slippage,Ask+stoploss*Point,
Ask-takeprofit*Point, NULL, 0, 0, Black) ;


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

I'm just training to better understand mql4. I use Comment to see what's going on inside the program in general.

 

Dimka-novitsek

Here, here's the right thing to correct, see for yourself.

Files:
0000001_3.mq4  2 kb
 
Thank you!!!!!! I named the variable wrong. I couldn't figure it out for 4 hours. I'll know. Thanks again!
 

I have a lot of problems with this indicator, but I'm not sure how to fix it. I have no idea what to do with this indicator, I will be very thankful for it. I myself am a complete zero in programming.

Files:
float_1.zip  4 kb
 
Who's got a neo-martin martin? Found one here, but it's not the same, the martin doesn't work.
 
vlandex:
There was an Expert Advisor like this somewhere - open a trade at random, if it closed in the red, then open the opposite one by 2 times increasing the lot. Where is it?

I think I have one of those in my toys