Reset value between up & down values?

 

Hi!


First of all; my EA is coming along great thanks to mq4l.com & FF.com! Thanks for all the help!

However, i'm afraid i'm stuck again.

- I have a signalup & signaldown value;

double signalup=iCustom(Symbol(),0,"Xochi",1,1);
double signaldown=iCustom(Symbol(),0,"Xochi",2,1);
  if (signalup!=EMPTY_VALUE&&signalup!=0)   
      {
      Order = SIGNAL_BUY;
      }

  if (signaldown!=EMPTY_VALUE&&signaldown!=0){ 
      Order = SIGNAL_SELL;
      }

Now, I want to add a third "reset" signal. Lets call it;

double signalreset=iCustom(Symbol(),0,"Xochi",3,1);

As soon as a trade is triggered I don't want to take a new trade until signalreset (value 3) shows up.

Is this possible? If so, how do I accomplish this?

I hope my explanation is sufficient, i'm not familiar w/ the coding jargon plus i'm not typing in my mother-tongue.

I hope someone can help me out

~WW

 
I don't want to take a new trade until signalreset (value 3) shows up.
I think you have it backwards, you don't want a new trade until a buy or sell signal shows up.
#define SIGNAL_NONE -1
int Order; // Must be global so it is remembered
int init(){ Order = SIGNAL_NONE; ... }
int start(){
  static datetime Time0; if (Time0 == Time[0]); return(0); Time0 = Time[0]; // Wait for a new bar.
  :
  if (signalup!=EMPTY_VALUE&&signalup!=0)   
      {
      Order = SIGNAL_BUY;
      }

  if (signaldown!=EMPTY_VALUE&&signaldown!=0){ 
      Order = SIGNAL_SELL;
      }
  if (Order == SIGNAL_NONE) return(0);
  :
  int ticket = OrderSend(...);
  if (ticket < 0) Alert("OrderSend failed: ", GetLastError());
  else Order == SIGNAL_NONE; // Wait for new signal
But if you really mean when the indicator posts a reset in buffer 3
int start(){
   static bool AllowedToTrade=false;
   if(!AllowedToTrade){
      double signalreset=iCustom(Symbol(),0,"Xochi",3,1);
      if (signalreset == ..) return(0); // No reset
      AllowedToTrade = true;           // Saw reset
   }
   :
   int ticket = OrderSend(...);
   if (ticket < 0) Alert("OrderSend failed: ", GetLastError());
   else AllowedToTrade = false; // Wait for new signal
 
Fixed thanks to WHRoeder!