How to code? - page 141

 

Restarting the EA after order closes for profit

Can anyone help me with this problem? I am using the attached EA and want it to open up one sequence after another if it closes for a profit during a certain time frame. It currently only runs one sequence then quits trading until you restart it. I've tried setting the extern stoptradingaftersequence to false with no avail. I've also tried using "while" and "if,else" functions without success. Keep in mind I'm a noob so any actual "where and what" to put in the code would be very appreciated.

Files:
 
buzzer:
Can anyone help me with this problem? I am using the attached EA and want it to open up one sequence after another if it closes for a profit during a certain time frame. It currently only runs one sequence then quits trading until you restart it. I've tried setting the extern stoptradingaftersequence to false with no avail. I've also tried using "while" and "if,else" functions without success. Keep in mind I'm a noob so any actual "where and what" to put in the code would be very appreciated.

I'll give you some hints:

First you need to calculate the profit since the start of the sequence. You can use a boolean variable like StartSequence=true; . Then when profit is above a certain level or when you want it to stop a sequence and start another set StartSequence=false. You will also need an initialization loop when StartSequence=false, it should do some calculations you want and then start the sequence all over.

Hope it points you to the right direction.

 

new system

hello;

first, thanks for you all and especially the programers for your constant help on this forum !

second, i would like you please to take a look at my strategy, it is really simple and i don't think it will take too much lines of coding :

first we buy and sell 1lot of the same currency at the same time, with a profit target of 20pips for both positions, and a stop loss of 20 pips for both positions too, so if the buy lot hit tp the sell positin will be closed and vice versa.

after the buy position tp is hit and sell positioin hit sl, the system should open 3 lots for buy and 2 lots for sell at the same time, with also profit target of 20pips for all positions, and a stop loss of 20 pips for all positions too. if the 3lots of buy hit tp and 2lot sell hit sl then the system should open another set of 3lots buy and 2lots sell same conditins as previouse set, so we are now going with the trend.

but if the sl of the 3lots buy where hit then all positins should be closed and we start again by 1lot buy+1lot sell, then according to which positin hit tp first it open our 3lots with the trend, and 2lots against the trend...and so on.

thanks on advance for your help and i hope i made it clear for you...

regards...

 

very short program@can't find out where the mistaKe

i write a program, but can't find out what was wrong~ ~

it say:

'SELECT_BY_POS' - variable expected C:\Program Files\Straighthold Trader\experts\scripts\ point tick value defination.mq4 (17, 21)

could anyone tell me what the mistake is?

although u may say that the program don't need to quote "orderselect", but it should be OK even if i add it, what the mistake is?

//+------------------------------------------------------------------+

//| point tick value defination.mq4 |

//| Copyright ?2008, MetaQuotes Software Corp. |

//| Forex Trading Software: Forex Trading Platform MetaTrader 4 |

//+------------------------------------------------------------------+

#property copyright "Copyright ?2008, MetaQuotes Software Corp."

#property link "http://www.metaquotes.net"

//+------------------------------------------------------------------+

//| script program start function |

//+------------------------------------------------------------------+

int start()

{ OrderSelect(int i,SELECT_BY_POS, MODE_TRADES);

Print("TEST");

Print("Point = " + Point);

Print ("TICKSIZE = " + MarketInfo(Symbol(),MODE_TICKSIZE));

Print ("TICKVALUE = " +MarketInfo(Symbol(),MODE_TICKVALUE));

Print("SPREAD = " + MarketInfo(Symbol(),MODE_SPREAD));

Print("STOPLEVEL = " + MarketInfo(Symbol(),MODE_STOPLEVEL));

Print ("LOTSIZE = " + MarketInfo(Symbol(),MODE_LOTSIZE));

return(0);

}

 
chiwing:
i write a program, but can't find out what was wrong~ ~

it say:

'SELECT_BY_POS' - variable expected C:\Program Files\Straighthold Trader\experts\scripts\ point tick value defination.mq4 (17, 21)

could anyone tell me what the mistake is?

although u may say that the program don't need to quote "orderselect", but it should be OK even if i add it, what the mistake is?

//+------------------------------------------------------------------+

//| point tick value defination.mq4 |

//| Copyright ?2008, MetaQuotes Software Corp. |

//| Forex Trading Software: Forex Trading Platform MetaTrader 4 |

//+------------------------------------------------------------------+

#property copyright "Copyright ?2008, MetaQuotes Software Corp."

#property link "http://www.metaquotes.net"

//+------------------------------------------------------------------+

//| script program start function |

//+------------------------------------------------------------------+

int start()

{ OrderSelect(int i,SELECT_BY_POS, MODE_TRADES);

Print("TEST");

Print("Point = " + Point);

Print ("TICKSIZE = " + MarketInfo(Symbol(),MODE_TICKSIZE));

Print ("TICKVALUE = " +MarketInfo(Symbol(),MODE_TICKVALUE));

Print("SPREAD = " + MarketInfo(Symbol(),MODE_SPREAD));

Print("STOPLEVEL = " + MarketInfo(Symbol(),MODE_STOPLEVEL));

Print ("LOTSIZE = " + MarketInfo(Symbol(),MODE_LOTSIZE));

return(0);

}

I think you should not define the variable i inside the OrderSelect() function; also this has no meaning...

 

HH LL price bars

I had this study when trading in the futures market with Esignal. I have not been able to find it on any forum in the forex.

I would like to be able to color bars based on the high or low regardless of the close except in the case of outside/inside bars which would have their own seperate color.

Attached is an example of what I'm looking for.

thanks

Files:
 

does anybody have the source code for william's indicator ? AO indicator ==awesome oscillator .

i can not find it in metaeditor , only custom indicator found .

Files:
www.jpg  29 kb
 

It is here.

And slightly different (attached).

It is 2 websources:

- https://www.mql5.com/en/code/7813

- http://ta.mql4.com/indicators/bills/awesome

Files:
filter_ao.mq4  3 kb
 

iCustom Calls from EA

Hello, can I put NULL for values that I just want to leave with what ever the indicators uses?

e.g. This is my call;

double ccfp0 = iCustom(NULL, 0, "CCFp",h,q,Fast,Slow,t,u,v,w,x,y,z,aa,bb,cc,dd,ee, ff,gg,hh,ii,2,0,0, 0, 1);

Now, the MT4 experts tab shows alot of errors;

CCFp GBPJPYm,H1: unknown subwindow number -1 for ObjectCreate function

Now if I only want the EA to be able to change a few of the settings, can I put the rest of the inputs to NULL?

double ccfp0 = iCustom(NULL, 0, "CCFp",NULL,NULL,Fast,Slow,NULL,NULL.......... ,0, 1);

Would like to try and get rid of this error.

Thank you

 
daytrade5:
I had this study when trading in the futures market with Esignal. I have not been able to find it on any forum in the forex.

I would like to be able to color bars based on the high or low regardless of the close except in the case of outside/inside bars which would have their own seperate color.

Attached is an example of what I'm looking for.

thanks

Some indies that could help:

https://www.mql5.com/en/forum/general

https://www.mql5.com/en/forum/173533

Reason: