Coding help - page 460

 
mladen:
3 -> is the maximum slippage

first 0 -> is the stop loss (you have to fill it with the stop loss price you wish for the order)

second 0 -> is the take profit (you have to fill it with the take profit price you wish for the order)

_________________

You can not place 10, 10 there

The stop loss must be the order open price +- stop loss in pips (points)

The same rule is valid for take profit - order open price +- take profit in pips (points)

ThankS so much, mladen.

Today i had learn the coding of your teach.

Feel so happy.

Have many coding I need to learn.

Thank you.

 
hock87:
ThankS so much, mladen.

Today i had learn the coding of your teach.

Feel so happy.

Have many coding I need to learn.

Thank you.

Just be stubborn (being stubborn is the best quality that a coder can have - when you code for a couple of years only that can push you forward)

 

Just checking in on this - was away for afew days

pipmagnet:
Sorry I didn't add this to the prior post - this is what I'm asking about - thanks in advance for your help/response.
 

Hello mladen ,

Can you help me to see did the code correct ? Please give some advise

double MA_Signal = iMA(Symbol(),0,FastMa,FastMaShift,FastMaMode,FastMaPrice,0);

double MA_Signala = iMA(Symbol(),0,UpperMa,UpperMaShift,UpperMaMode,UpperMaPrice,0);

double MA_Signalb = iMA(Symbol(),0,LowerMa,LowerMaShift,LowerMaMode,LowerMaPrice,0);

double MACD = iCustom(Symbol(),0,"MyMACD",Macd_fast,Macd_slow,Macd_signal,Macd_price,MODE_MAIN,i);

double MACDsig = iCustom(Symbol(),0,"MyMACD",Macd_fast,Macd_slow,Macd_signal,Macd_price,MODE_SIGNAL,i);

double Bbands = iCustom(Symbol(),0,"BBands_Stop_v2",Length,Deviation,MoneyRisk,PRICE_CLOSE,2);

double Ma_Bid_Diff = MathAbs(MA_Signal - Bid)/vPoint;

if ( MA_Signal>MA_Signala ) if ( MACD>0 && MACD>MACDsig ) if (Bbands MAOpenDistance && Bid > MA_Signala ) Signal = 1;

if ( MA_Signal<MA_Signalb ) if ( MACD<0 && MACDMA_Signal) if ( Ma_Bid_Diff > MAOpenDistance && Bid < MA_Signalb ) Signal = -1;

One more question is about the "BBands_Stop_v2" , behind the number is for what ?

Sorry for bother because had learning how to code , many things had confuse

 
stevenpun:
Hello mladen ,

Can you help me to see did the code correct ? Please give some advise

double MA_Signal = iMA(Symbol(),0,FastMa,FastMaShift,FastMaMode,FastMaPrice,0);

double MA_Signala = iMA(Symbol(),0,UpperMa,UpperMaShift,UpperMaMode,UpperMaPrice,0);

double MA_Signalb = iMA(Symbol(),0,LowerMa,LowerMaShift,LowerMaMode,LowerMaPrice,0);

double MACD = iCustom(Symbol(),0,"MyMACD",Macd_fast,Macd_slow,Macd_signal,Macd_price,MODE_MAIN,i);

double MACDsig = iCustom(Symbol(),0,"MyMACD",Macd_fast,Macd_slow,Macd_signal,Macd_price,MODE_SIGNAL,i);

double Bbands = iCustom(Symbol(),0,"BBands_Stop_v2",Length,Deviation,MoneyRisk,PRICE_CLOSE,2);

double Ma_Bid_Diff = MathAbs(MA_Signal - Bid)/vPoint;

if ( MA_Signal>MA_Signala ) if ( MACD>0 && MACD>MACDsig ) if (Bbands MAOpenDistance && Bid > MA_Signala ) Signal = 1;

if ( MA_Signal<MA_Signalb ) if ( MACD<0 && MACDMA_Signal) if ( Ma_Bid_Diff > MAOpenDistance && Bid < MA_Signalb ) Signal = -1;

One more question is about the "BBands_Stop_v2" , behind the number is for what ?

Sorry for bother because had learning how to code , many things had confuse

stevenpun

Calls to MyMACD abd BBands_Stop_V2 are not correct. The last two parameters for custom indicators must be buffer number and shift : you need one more parameter before the last one that will specify which buffer value to retrieve

 
mladen:
stevenpun Calls to MyMACD abd BBands_Stop_V2 are not correct. The last two parameters for custom indicators must be buffer number and shift : you need one more parameter before the last one that will specify which buffer value to retrieve

Thanks for your reply and i get some answer , but still have confuse .

Now i use buffer 4 and 5 to identify the trend , but how i know what the number of shift i need to put ?

double Bbands = iCustom(Symbol(),0,"BBands_Stop_v2",Length,Deviation,MoneyRisk,PRICE_CLOSE,4,1); double Bbands2 = iCustom(Symbol(),0,"BBands_Stop_v2",Length,Deviation,MoneyRisk,PRICE_CLOSE,5,2);

In the signal part , is that i need to change ?

About the "MyMacd" just ignore it , because i just change the classic macd close price to open price to test only .

 
stevenpun:
Thanks for your reply and i get some answer , but still have confuse .

Now i use buffer 4 and 5 to identify the trend , but how i know what the number of shift i need to put ?

double Bbands = iCustom(Symbol(),0,"BBands_Stop_v2",Length,Deviation,MoneyRisk,PRICE_CLOSE,4,1); double Bbands2 = iCustom(Symbol(),0,"BBands_Stop_v2",Length,Deviation,MoneyRisk,PRICE_CLOSE,5,2);

In the signal part , is that i need to change ?

About the "MyMacd" just ignore it , because i just change the classic macd close price to open price to test only .

stevenpun

The last number in the iCustom() call is the shift

If you want to read the current bar value of the custom indicator use 0. If you want to use the first closed bar use 1 for shift, and so on ...

 
mladen:
stevenpun

The last number in the iCustom() call is the shift

If you want to read the current bar value of the custom indicator use 0. If you want to use the first closed bar use 1 for shift, and so on ...

So is they 2 number cannot be the same right ?

and the signal part i need to change ?

 
stevenpun:
So is they 2 number cannot be the same right ? and the signal part i need to change ?

stevenpun

The simplest way for BBands_Stop_v2 indicator to use is to use buffers 2 and 3. If buffer 2 is > -1, then it is signal for down. If the buffer 3 is > -1, then it is signal for up. And you should use same shift value in that case

 
mladen:
stevenpun The simplest way for BBands_Stop_v2 indicator to use is to use buffers 2 and 3. If buffer 2 is > -1, then it is signal for down. If the buffer 3 is > -1, then it is signal for up. And you should use same shift value in that case

Thanks , at tsd really can learn a lot of coding .

When starting i feel very hard to code for a simple ea , but now i feel very interesting

Reason: