Orders Execution
0
Views
0
Downloads
0
Favorites
Profitability Reports
GBP/CAD
Oct 2024 - Jan 2025
0.00 %
Total Trades
0
Won Trades
0
Lost trades
0
Win Rate
0.0 %
Expected payoff
0.00
Gross Profit
0.00
Gross Loss
0.00
Total Net Profit
0.00
-100%
-50%
0%
50%
100%
GBP/USD
Oct 2024 - Jan 2025
0.00 %
Total Trades
0
Won Trades
0
Lost trades
0
Win Rate
0.0 %
Expected payoff
0.00
Gross Profit
0.00
Gross Loss
0.00
Total Net Profit
0.00
-100%
-50%
0%
50%
100%
[ea]goldfish_v06g_Ron_MT4
#property copyright "Ron Thompson"
#property link "http://www.lightpatch.com/forex"
// This EA is NEVER to be SOLD individually
// This EA is NEVER to be INCLUDED as part of a collection that is SOLD
//
// goldfish (flopping around like a goldfish out of water)
//
#property copyright "Ron Thompson"
#property link "http://www.ForexMT4.com/"
// generic user input
extern double Lots=0.1;
extern int TrailStop=30;
// start the flopping at a LONG position
bool FSell=false; // where to go next
bool FBuy=true; // for Future Buy/Sell
datetime bartime;
int bartick=0;
int Slippage=2;
// File handling
int handle=0;
// naming and numbering
double MagicNumber = 200512062015;
string TradeComment = "goldfish";
//+------------------------------------+
//| Custom init (usually empty on EAs) |
//|------------------------------------|
// Called ONCE when EA is added to chart
// or expert is re-compiled
int init()
{
Comment(TradeComment);
}
//+------------------------------------+
//| Custom deinit(usually empty on EAs)|
//+------------------------------------+
// Called ONCE when EA is removed from chart
int deinit()
{
Comment(" ");
}
//+------------------------------------+
//| EA main code |
//+------------------------------------+
// Called EACH TICK
int start()
{
double p=Point;
double spread=Ask-Bid;
int cnt=0;
int OpenOrders=0;
double gainloss;
double SL;
double TP;
// use bar movement to prevent multiple orders per bar
if(bartime!=Time[0])
{
bartime=Time[0];
bartick++;
}
for(cnt=0; cnt<OrdersTotal(); cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if( OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
{
OpenOrders++;
}
}
//initial direction and catch any stoploss that we missed
if (OpenOrders==0)
{
if (FBuy==true && FSell==false)
{
SL=Ask-(TrailStop*p);
TP=0;
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,SL,TP,TradeComment+"BUY",MagicNumber,White);
FBuy=false;
FSell=true;
}
if (FBuy==false && FSell==true)
{
SL=Bid+(TrailStop*p);
TP=0;
OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,SL,TP,TradeComment+"SELL ",MagicNumber,Red);
FBuy=true;
FSell=false;
}
}
// Trailing stop
for(cnt=0; cnt<OrdersTotal(); cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if( OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
{
if(OrderType()==OP_BUY)
{
gainloss=Bid-OrderStopLoss();
if ( gainloss > (TrailStop*p) )
{
SL=Bid-(TrailStop*p);
TP=OrderTakeProfit();
OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP, White);
}
}//buy
if(OrderType()==OP_SELL)
{
gainloss=OrderStopLoss()-Ask;
if ( gainloss > (TrailStop*p) )
{
SL=Ask+(TrailStop*p);
TP=OrderTakeProfit();
OrderModify(OrderTicket(),OrderOpenPrice(),SL,TP, Red);
}
}//sell
} // if(OrderSymbol)
} // for
} // start()
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---