Ride the swap - page 2

 
SIMONE MARELLI:

I have tried, always same problem, is getting me crazy 

Cant help you anymore unless you post the code to enter trade. You might also want to check PSwap and NSwap are not more than 1 at the same time.

 
Syed Oarasul Islam:

Cant help you anymore unless you post the code to enter trade. You might also want to check PSwap and NSwap are not more than 1 at the same time.

How to post the code in the right way?

 

Why >1 and not >0 ?

Post all related functions about orders opening, we cannot help you with only some part of it.

 
Fabio Cavalloni:

Why >1 and not >0 ?

Post all related functions about orders opening, we cannot help you with only some part of it.

Because, for my strategy, i want it higher than 1. By the way, i don't remember what to do to share the code

 
SIMONE MARELLI:

How to post the code in the right way?

Press Alt+S to paste your code

 
SIMONE MARELLI:

Because, for my strategy, i want it higher than 1. By the way, i don't remember what to do to share the code

Copy and paste the code in the field opened with Alt+S keys.

Like this
 
Syed Oarasul Islam:

Press Alt+S to paste your code


   static bool Sell = false;

   static bool Buy = false;

   double PSwap = SymbolInfoDouble(Symbol(),SYMBOL_SWAP_LONG);

   double NSwap = SymbolInfoDouble(Symbol(),SYMBOL_SWAP_SHORT);

   if( PSwap > 1) {
    Buy=true;
    Sell=false;
   }

   if (NSwap > 1){
    Sell=true;
    Buy=false;
   }

and this is the code you sent me, next this

if(Buy==true)
    {
     if(...)
     {signal="buy";}
    }
   
   if(Sell==true)
    {
     if(...)
     {signal="sell";}
    }

i am testing this, if it works, alternatively i have made an input bool to allow or not buy and sell and i will manually choose them

Reason: