Results 1 to 6 of 6

Thread: Memperbaiki histogram CCI di EA saya

  1. #1
    Halo,

    saya berputus asa pada masa ini.

    Mungkin seseorang boleh membantu saya dan melihat ke EA saya.

    Salah satu syarat saya ialah EA hanya mengambil masa yang lama jika histogram CCI melebihi sifar dan pendek jika histogram CCI berada di bawah sifar.
    Saya fikir saya berkod, tetapi EA tidak melakukannya dengan cara yang betul.

    Lihat seseorang kesilapan?
    Sekiranya terdapat sebarang pertanyaan, jangan ragu-ragu!

    Kod dimasukkan #define SIGNAL_NONE 0 #define SIGNAL_BUY 1 #define SIGNAL_SELL 2 #define SIGNAL_CLOSEBUY 3 #define SIGNAL_CLOSESELL 4 #property copyright # link property extern int MagicNumber = 558; extern bool SignalMail = False; extern bool EachTickMode = False; extern double Lots = 0.5; extern int Slippage = 3; extern bool UseStopLoss = True; extern int StopLoss = 10; extern bool UseTakeProfit = Benar; extern int TakeProfit = 40; extern bool UseTrailingStop = False; extern int TrailingStop = 10; int semasa; double cci = iCustom (NULL, 0, histogram CCI, 14,0,0); int BarCount; bool TickCheck = False;/ ----------------------------------------------- ------------------- /| fungsi permulaan pakar |/ ----------------------------------------------- ------------------- int init () {BarCount = Bar; jika (EachTickMode) Semasa = 0; lagi semasa = 1; kembali (0); }/ ---------------------------------------------- -------------------- /| fungsi deinitialization pakar |/ ----------------------------------------------- ------------------- int deinit () {return (0); }/ ---------------------------------------------- -------------------- /| fungsi permulaan pakar |/ ----------------------------------------------- ------------------- int start () {int Order = SIGNAL_NONE; int Jumlah, Tiket; double StopLossLevel, TakeProfitLevel; jika (Bar SetiapTickMode! = BarCount) TickCheck = Salah; Jumlah = OrdersTotal (); Order = SIGNAL_NONE;/ ----------------------------------------------- ------------------- /| Pembolehubah Variable |/ ----------------------------------------------- ------------------- double Buy1_11 = iClose (NULL, 0, Current 0); double Buy1_12 = iOpen (NULL, 0, Current 0); double Buy1_21 = iClose (NULL, 0, Current 1); double Buy1_22 = iOpen (NULL, 0, Current 1); double Buy1_31 = iClose (NULL, 0, Current 2); double Buy1_32 = iOpen (NULL, 0, Current 2); double Sell1_11 = iClose (NULL, 0, Current 0); double Sell1_12 = iOpen (NULL, 0, Current 0); double Sell1_21 = iClose (NULL, 0, Current 1); double Sell1_22 = iOpen (NULL, 0, Current 1); double Sell1_31 = iClose (NULL, 0, Current 2); double Sell1_32 = iOpen (NULL, 0, Current 2);/ ----------------------------------------------- ------------------- /| Akhir Pembolehubah |/ ----------------------------------------------- ------------------- /Check position bool IsTrade = False; untuk (int i = 0; i lt; Jumlah; i ) {OrderSelect (i, SELECT_BY_POS, MODE_TRADES); jika (OrderType () lt; = OP_SELL OrderSymbol () == Simbol ()) {IsTrade = True; jika (OrderType () == OP_BUY) {//Close/ ---------------------------------- -------------------------------- /| IsyaratMulakan (Beli Keluar) |/ ----------------------------------------------- ------------------- if (Buy1_21 gt; Buy1_22 Buy1_11 lt; Buy1_12) Order = SIGNAL_CLOSEBUY;/ ----------------------------------------------- ------------------- /| Akhir Isyarat (Keluar Keluar) |/ ----------------------------------------------- ------------------- if (Order == SIGNAL_CLOSEBUY ((EachTickMode! TickCheck) || (! EachTickMode (Bar! = BarCount)))) {OrderClose (OrderTicket (), OrderLots (), Tawaran, Slippage, MediumSeaGreen); jika (SignalMail) SendMail (# 91; Isyarat Alert # 93 ;, # 91; Simbol () # 93; DoubleToStr (Tawaran, Digit) Beli Tutup); jika (! EachTickMode) BarCount = Bar; IsTrade = Palsu; terus; }/Berhenti trailing jika (UseTrailingStop TrailingStop gt; 0) {if (Bid - OrderOpenPrice () gt; Point * TrailingStop) {if (OrderStopLoss () ), Bid - Point * TrailingStop, OrderTakeProfit (), 0, MediumSeaGreen); jika (! EachTickMode) BarCount = Bar; terus; }}}} else {//Close/ -------------------------------------- ---------------------------- /| Begin Signal (Keluar Jual) |/ ----------------------------------------------- ------------------- if (Sell1_21 lt; Sell1_22 Sell1_11 gt; Sell1_12) Order = SIGNAL_CLOSESELL;/ ----------------------------------------------- ------------------- /| Akhir Isyarat (Keluar Jual) |/ ----------------------------------------------- ------------------- if (Order == SIGNAL_CLOSESELL ((EachTickMode! TickCheck) || (! EachTickMode (Bar! = BarCount)))) {OrderClose (OrderTicket (), OrderLots (), Ask, Slippage, DarkOrange); jika (SignalMail) SendMail (# 91; Isyarat Alert # 93 ;, # 91; Simbol () # 93; DoubleToStr (Tanya, Digit) Close Sell); jika (! EachTickMode) BarCount = Bar; IsTrade = Palsu; terus; }/Berhenti trailing jika (UseTrailingStop TrailingStop gt; 0) {if ((OrderOpenPrice () - Ask) gt; (Point * TrailingStop)) {if ((OrderStopLoss () gt; (OrderStopLoss () == 0)) {OrderModify (OrderTicket (), OrderOpenPrice (), Ask Point * TrailingStop, OrderTakeProfit (), 0, DarkOrange); jika (! EachTickMode) BarCount = Bar; terus;}}}}}}/ ----------------------------------------- ------------------------- /| Begin Signal (Kemasukan) |/ ----------------------------------------------- ------------------- if (Buy1_11 gt; Buy1_12 Buy1_21 gt; Buy1_22 Buy1_32 gt; Buy1_31 cci gt; 0) Order = SIGNAL_BUY; jika (Sell1_11 lt; Sell1_12 Sell1_21 lt; Sell1_22 Sell1_32 lt; Sell1_31 cci lt; 0) Pesanan = SIGNAL_SELL;/ ----------------------------------------------- ------------------- /| Akhir Isyarat |/ ----------------------------------------------- ------------------- /Buy if (Order == SIGNAL_BUY ((EachTickMode! TickCheck) || (! EachTickMode (Bar! = BarCount)))) { jika (! IsTrade) {//Periksa margin percuma jika (AccountFreeMargin () lt; (1000 * Lot)) {Print (Kami tidak mempunyai wang. Margin Percuma =, AccountFreeMargin ()); kembali (0); } jika (UseStopLoss) StopLossLevel = Ask - StopLoss * Point; lain StopLossLevel = 0.0; jika (UseTakeProfit) TakeProfitLevel = Tanya TakeProfit * Point; lain TakeProfitLevel = 0.0; Tiket = OrderSend (Symbol (), OP_BUY, Banyak, Ask, Slippage, StopLossLevel, TakeProfitLevel, Beli (# MagicNumber ), MagicNumber, 0, DodgerBlue); jika (Tiket gt; 0) {if (OrderSelect (Tiket, SELECT_BY_TICKET, MODE_TRADES)) {Print (BUY order dibuka:, OrderOpenPrice ()); jika (SignalMail) SendMail (# 91; Isyarat Alert # 93 ;, # 91; Simbol () # 93; DoubleToStr (Tanya, Digit) Beli Terbuka); } else {Print (Ralat membuka pesanan BUY:, GetLastError ()); }} jika (EachTickMode) TickCheck = Benar; jika (! EachTickMode) BarCount = Bar; kembali (0); }}/Menjual jika (Order == SIGNAL_SELL ((EachTickMode! TickCheck) || (EachTickMode (Bar! = BarCount)))) {if (IsTrade) {//Check margin free if (AccountFreeMargin () (1000 * Banyak)) {Cetak (Kami tidak mempunyai wang. Margin Percuma =, AccountFreeMargin ()); kembali (0); } jika (UseStopLoss) StopLossLevel = Bidaan StopLoss * Point; lain StopLossLevel = 0.0; jika (UseTakeProfit) TakeProfitLevel = Bid ​​- TakeProfit * Point; lain TakeProfitLevel = 0.0; Tiket = OrderSend (Simbol (), OP_SELL, Banyak, Tawaran, Slippage, StopLossLevel, TakeProfitLevel, Menjual (# MagicNumber ), MagicNumber, 0, DeepPink); jika (Tiket gt; 0) {jika (OrderSelect (Tiket, SELECT_BY_TICKET, MODE_TRADES)) {Print (pesanan SELESYAR dibuka:, OrderOpenPrice ()); jika (SignalMail) SendMail (# 91; Isyarat Alert # 93 ;, # 91; Symbol () # 93; DoubleToStr (Tawaran, Digit) Open Sell); } else {Print (Error opening SELL order:, GetLastError ()); }} jika (EachTickMode) TickCheck = Benar; jika (! EachTickMode) BarCount = Bar; kembali (0); }} jika (! EachTickMode) BarCount = Bar; kembali (0); }/ ---------------------------------------------- --------------------

  2. #2
    Yang di bawah sepatutnya berada pada fungsi mula (): Kod dimasukkan cci = iCustom (NULL, 0, histogram CCI, 14,0,0);

  3. #3

    Quote Originally Posted by ;
    Terima kasih atas jawapan anda FerruFX, adakah sekarang betul?
    Sekiranya anda menggunakan CCI dalam masa nyata, ia harus baik-baik saja. Saya cadangkan untuk menentukan CCI anda seperti yang anda lakukan dengan iClose dan iOpen ... dengan Current atau Current ...

  4. #4
    Bagaimana saya melakukan ini? CCI harus: bar semasa Tutup Terima kasih di Advance

  5. #5

    Quote Originally Posted by ;
    How I do this? The CCI should be: current bar an Close Thank you in Advance
    Berikut contohnya. Kemudian anda perlu menggunakan cci_0 dan cci_1 dalam keadaan kemasukan anda dengan sewajarnya. Kod dimasukkan dua cci_0 = iCustom (NULL, 0, histogram CCI, 14,0,0);/Lilin semasa cci_1 = iCustom (NULL, 0, histogram CCI, 14,0,1);/Lilin pertama ditutup

  6. #6

    Quote Originally Posted by ;
    Halo, saya berputus asa pada masa ini. Mungkin seseorang boleh membantu saya dan melihat ke EA saya. Salah satu syarat saya ialah EA hanya mengambil masa yang lama jika histogram CCI melebihi sifar dan pendek jika histogram CCI berada di bawah sifar. Saya fikir saya berkod sedemikian
    I think this ea was made via an expert advisor builder. You have to add the cci-option to the conditions. Further I think you do not need to call the custom-indior, i think to read the cci via iCCI( would be sufficient (if gt; or lt; 0.0) ...

Kebenaran Posting

  • Anda tidak boleh menghantar thread baru
  • Anda tidak boleh membalas kiriman
  • Anda tidak boleh mengedit siaran anda
  • Anda tidak boleh menyiarkan lampiran
  •  
  • Kod BB Hidup
  • Smilies Hidup
  • Kod [IMG] adalah Hidup
  • Kod [VIDEO] adalah Hidup
  • Kod HTML Tidak Hidup