Writing free EAs - page 5

 
Please write an EA on fractals.
Detailed pictures of the strategy are attached.


BUY SELL

Location of fractals is strictly as on the picture.
TP is calculated according to the scheme on the picture.
SL is placed under the fractal for BUY and over the fractal for SELL.
Slippage and spread are accounted for in the code of the Expert Advisor.
In the input variables of the Expert Advisor: Lot
 
yura droba:
Please write an EA on fractals.
Detailed pictures of the strategy are attached.



Location of fractals is strictly as on the picture.
TP is calculated according to the scheme on the picture.
SL is placed under the fractal for BUY and over the fractal for SELL.
Slippage and spread are accounted for in the code of the Expert Advisor.
In the input variables of the Expert Advisor: Lot

You have specified equality as in geometry, but in the real market equality is almost never achieved. You have to accept acceptable deviations as a minimum.

 
Good afternoon!
Guys, can anyone help me?
I have a strategy with a semi-automatic EA. I need to add to it automatic opening of orders in opposite directions at the same time. And the EA should enter the market as soon as the last order is closed. I.e., the last buy order was closed, it opens the buy order at once. If the last Sell order is closed, it opens a Sell order right away.

As for functionality, add buttons: buy - on/off

Sell - on/off

 

Please advise what's wrong with the code. It compiles but does not trade in the tester.


extern double StopLoss =0;

extern double TakeProfit =0;

extern double Lots =0.1;

extern double Prots =0.0;

bool Work=true;

string Symb;


extern int Bands_period = 20;

extern double Bands_deviation = 2;





int

Total, // Number of orders in the window

Tip=-1, // Order type selected (B=0,S=1)

Ticket; // Order number

double

MA_1_t, // Value. MA_1 current value".

Lot, // Number of lots in the selected order

Lts, // Lots number in the open order

Min_Lot, // Minimum number of lots

Step, // Step of lot size change

Free, // Current free funds

One_Lot, // Value of one lot

Price, // Price of the selected order

SL, // SL price of the selected order

TP; // TP of the selected order

bool

Ans =false, // Server answer after the closing

Cls_B=false, // Criterion for closing Buy

Cls_S=false, // Criterion for closing Sell

Opn_B=false, // Criterion for opening Buy

Opn_S=false; // Criterion for opening Sell

//----------------------------------------------------------------------------------------------------------//

int start()

{

double PercentBB1;

double PercentBB2;

double ma;

int cnt, total;



//------------------------------------------Protect against errors and bugs--------------------------------------//

if(Bars<100) //if the number of candlesticks is less than 100

{

Print("The number of bars is too low");

return(0);

}

if (Volume[0] < 1.0) // if(Volume< 1.0) // if traded then volume is more than 0

{

Comment("No trades... Waiting for a new bar...");

return(0);

}

if (AccountFreeMargin()<(1000*Lots))

{

Comment("Not enough money. Margin level is less than ...");

return(0);

}


//-----------------------------------------Конец защиты от косяков-----------------------------------------//


PercentBB1 = iCustom(NULL,PERIOD_H1, "cBB",Bands_period,0,Bands_deviation,0 );

PercentBB2 = iCustom(NULL,PERIOD_M15, "cBB",Bands_period,0,Bands_deviation,0);

ma = iMA(NULL,PERIOD_M15,20, 0, 0, PRICE_CLOSE, 0);


total=OrdersTotal();

//-------------------------------------------Закрытие позиций------------------------------------------

for(cnt=0;cnt<total;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderType()<=OP_SELL &&

OrderSymbol()==Symbol())

{

if(OrderType()==OP_BUY)

{

if(PercentBB1 <=30.0000 && PercentBB1 >=70.0000 && Bid == ma)

{

Ticket=OrderClose(OrderTicket(),OrderLots(),Bid,50,Violet);

return(0);

}

}

if(OrderType()==OP_SELL)

{

if(PercentBB1 <=30.0000 && PercentBB1 >=70.0000 && Ask == ma )

{

Ticket=OrderClose(OrderTicket(),OrderLots(),Ask,50,Violet);

return(0);

}

}

}

}

//-----------------------------------------------Конец закрытия позиции------------------------------------

if(total==0) // if there are no positions

{

//open long position

if(PercentBB1 >=30.0000 && PercentBB1 <=70.0000 && PercentBB2 <=0.0000 )

{

Ticket=OrderSend(Symbol(), OP_BUY,Lots,Ask,50,0, "Long position",16384,0,Red);

return(0);

}

//open short position

if(PercentBB1 >= 30.0000 && PercentBB1 <=70.0000 && PercentBB2 >= 100.0000)

{

Ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,50,0, "Short Position",16384,0,Red);

return(0);

}

}

return(0);


 
Юра Юра:

Please advise what's wrong with the code. Compiles but does not trade in the tester.


PercentBB1 = iCustom(NULL,PERIOD_H1, "cBB",Bands_period,0,Bands_deviation,0 );

PercentBB2 = iCustom(NULL,PERIOD_M15, "cBB",Bands_period,0,Bands_deviation,0);

no one help
no indicator

 
Олег Новицкий:
Hi all!!! is it possible to write an advisor on an arrow indicator with a customizable stop and take on the reverse signal of the indicator

you can't, your indicators are decompiled

 

Ready to accept ToR with detailed description of trading strategy for FREE execution. Expert Advisor or indicator for MT4 terminal.

Strategies of "template" type are not subject to review. Therefore I reserve the right to independently select TOR with subsequent execution.

On deadlines, please do not mention. Time for coding 2-3 hours per day. In fact, this is the price for free execution.

***

 
Evgenii Voroshilov:

Ready to accept ToR with detailed description of trading strategy for FREE execution. Expert Advisor or indicator for MT4 terminal.

Strategies of "template" type are not subject to review. Therefore I reserve the right to independently select TOR with subsequent execution.

On deadlines, please do not mention. Time for coding 2-3 hours per day. In fact, this is the price for free execution.

***

If you want to do it for free, you'll have to do it publicly.

 
Hello! I don't know anything about writing EAs, that's why I have this question. Is it possible to write an EA based on an indicator without a source code?
 
Alexey Olhovikov:
Hello, I don't know anything about writing EAs, that's why I have this question. Is it possible to write an EA based on an indicator without a source code?

You can.

Reason: